Class UserEvent.Builder (0.2.0)

public static final class UserEvent.Builder extends GeneratedMessageV3.Builder<UserEvent.Builder> implements UserEventOrBuilder

UserEvent captures all metadata information DiscoveryEngine API needs to know about how end users interact with customers' website.

Protobuf type google.cloud.discoveryengine.v1beta.UserEvent

Implements

UserEventOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addAllDocuments(Iterable<? extends DocumentInfo> values)

public UserEvent.Builder addAllDocuments(Iterable<? extends DocumentInfo> values)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.discoveryengine.v1beta.DocumentInfo>
Returns
TypeDescription
UserEvent.Builder

addAllPromotionIds(Iterable<String> values)

public UserEvent.Builder addAllPromotionIds(Iterable<String> values)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameter
NameDescription
valuesIterable<String>

The promotionIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

addAllTagIds(Iterable<String> values)

public UserEvent.Builder addAllTagIds(Iterable<String> values)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameter
NameDescription
valuesIterable<String>

The tagIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

addDocuments(DocumentInfo value)

public UserEvent.Builder addDocuments(DocumentInfo value)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
valueDocumentInfo
Returns
TypeDescription
UserEvent.Builder

addDocuments(DocumentInfo.Builder builderForValue)

public UserEvent.Builder addDocuments(DocumentInfo.Builder builderForValue)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
builderForValueDocumentInfo.Builder
Returns
TypeDescription
UserEvent.Builder

addDocuments(int index, DocumentInfo value)

public UserEvent.Builder addDocuments(int index, DocumentInfo value)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameters
NameDescription
indexint
valueDocumentInfo
Returns
TypeDescription
UserEvent.Builder

addDocuments(int index, DocumentInfo.Builder builderForValue)

public UserEvent.Builder addDocuments(int index, DocumentInfo.Builder builderForValue)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameters
NameDescription
indexint
builderForValueDocumentInfo.Builder
Returns
TypeDescription
UserEvent.Builder

addDocumentsBuilder()

public DocumentInfo.Builder addDocumentsBuilder()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
DocumentInfo.Builder

addDocumentsBuilder(int index)

public DocumentInfo.Builder addDocumentsBuilder(int index)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
indexint
Returns
TypeDescription
DocumentInfo.Builder

addPromotionIds(String value)

public UserEvent.Builder addPromotionIds(String value)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameter
NameDescription
valueString

The promotionIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

addPromotionIdsBytes(ByteString value)

public UserEvent.Builder addPromotionIdsBytes(ByteString value)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameter
NameDescription
valueByteString

The bytes of the promotionIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public UserEvent.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
UserEvent.Builder
Overrides

addTagIds(String value)

public UserEvent.Builder addTagIds(String value)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameter
NameDescription
valueString

The tagIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

addTagIdsBytes(ByteString value)

public UserEvent.Builder addTagIdsBytes(ByteString value)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameter
NameDescription
valueByteString

The bytes of the tagIds to add.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

build()

public UserEvent build()
Returns
TypeDescription
UserEvent

buildPartial()

public UserEvent buildPartial()
Returns
TypeDescription
UserEvent

clear()

public UserEvent.Builder clear()
Returns
TypeDescription
UserEvent.Builder
Overrides

clearAttributes()

public UserEvent.Builder clearAttributes()
Returns
TypeDescription
UserEvent.Builder

clearAttributionToken()

public UserEvent.Builder clearAttributionToken()

Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of [PredictionService.Predict][]. This field enables accurate attribution of recommendation model performance. The value must be one of:

  • [PredictResponse.attribution_token][] for events that are the result of [PredictionService.Predict][].
  • SearchResponse.attribution_token for events that are the result of [SearchService.Search][].
  • [CompleteQueryResponse.attribution_token][] for events that are the result of [SearchService.CompleteQuery][]. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass [PredictResponse.attribution_token][] as a URL parameter to product K's page. When recording events on product K's page, log the [PredictResponse.attribution_token][] to this field.

string attribution_token = 8;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearCompletionInfo()

public UserEvent.Builder clearCompletionInfo()

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Returns
TypeDescription
UserEvent.Builder

clearDirectUserRequest()

public UserEvent.Builder clearDirectUserRequest()

Should set to true if the request is made directly from the end user, in which case the UserEvent.user_info.user_agent can be populated from the HTTP request. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events). This should not be set when using the JavaScript tag in UserEventService.CollectUserEvent.

bool direct_user_request = 5;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearDocuments()

public UserEvent.Builder clearDocuments()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
UserEvent.Builder

clearEventTime()

public UserEvent.Builder clearEventTime()

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Returns
TypeDescription
UserEvent.Builder

clearEventType()

public UserEvent.Builder clearEventType()

Required. User event type. Allowed values are: Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans Retail-related values:
  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s) Media-related values:
  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.

string event_type = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public UserEvent.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
UserEvent.Builder
Overrides

clearFilter()

public UserEvent.Builder clearFilter()

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for search events, the associated [SearchService.SearchRequest][] may contain a filter expression in [SearchService.SearchRequest.filter][] conforming to https://google.aip.dev/160#filtering. Similarly, for view-item-list events that are generated from a [PredictionService.PredictRequest][], this field may be populated directly from [PredictionService.PredictRequest.filter][] conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string filter = 9;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearMediaInfo()

public UserEvent.Builder clearMediaInfo()

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Returns
TypeDescription
UserEvent.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public UserEvent.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
UserEvent.Builder
Overrides

clearPageInfo()

public UserEvent.Builder clearPageInfo()

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Returns
TypeDescription
UserEvent.Builder

clearPanel()

public UserEvent.Builder clearPanel()

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Returns
TypeDescription
UserEvent.Builder

clearPromotionIds()

public UserEvent.Builder clearPromotionIds()

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearSearchInfo()

public UserEvent.Builder clearSearchInfo()

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Returns
TypeDescription
UserEvent.Builder

clearSessionId()

public UserEvent.Builder clearSessionId()

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sesion_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.

string session_id = 6;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearTagIds()

public UserEvent.Builder clearTagIds()

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clearTransactionInfo()

public UserEvent.Builder clearTransactionInfo()

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Returns
TypeDescription
UserEvent.Builder

clearUserInfo()

public UserEvent.Builder clearUserInfo()

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Returns
TypeDescription
UserEvent.Builder

clearUserPseudoId()

public UserEvent.Builder clearUserPseudoId()

Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

clone()

public UserEvent.Builder clone()
Returns
TypeDescription
UserEvent.Builder
Overrides

containsAttributes(String key)

public boolean containsAttributes(String key)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameter
NameDescription
keyString
Returns
TypeDescription
boolean

getAttributes()

public Map<String,CustomAttribute> getAttributes()

Use #getAttributesMap() instead.

Returns
TypeDescription
Map<String,CustomAttribute>

getAttributesCount()

public int getAttributesCount()

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Returns
TypeDescription
int

getAttributesMap()

public Map<String,CustomAttribute> getAttributesMap()

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Returns
TypeDescription
Map<String,CustomAttribute>

getAttributesOrDefault(String key, CustomAttribute defaultValue)

public CustomAttribute getAttributesOrDefault(String key, CustomAttribute defaultValue)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameters
NameDescription
keyString
defaultValueCustomAttribute
Returns
TypeDescription
CustomAttribute

getAttributesOrThrow(String key)

public CustomAttribute getAttributesOrThrow(String key)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameter
NameDescription
keyString
Returns
TypeDescription
CustomAttribute

getAttributionToken()

public String getAttributionToken()

Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of [PredictionService.Predict][]. This field enables accurate attribution of recommendation model performance. The value must be one of:

  • [PredictResponse.attribution_token][] for events that are the result of [PredictionService.Predict][].
  • SearchResponse.attribution_token for events that are the result of [SearchService.Search][].
  • [CompleteQueryResponse.attribution_token][] for events that are the result of [SearchService.CompleteQuery][]. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass [PredictResponse.attribution_token][] as a URL parameter to product K's page. When recording events on product K's page, log the [PredictResponse.attribution_token][] to this field.

string attribution_token = 8;

Returns
TypeDescription
String

The attributionToken.

getAttributionTokenBytes()

public ByteString getAttributionTokenBytes()

Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of [PredictionService.Predict][]. This field enables accurate attribution of recommendation model performance. The value must be one of:

  • [PredictResponse.attribution_token][] for events that are the result of [PredictionService.Predict][].
  • SearchResponse.attribution_token for events that are the result of [SearchService.Search][].
  • [CompleteQueryResponse.attribution_token][] for events that are the result of [SearchService.CompleteQuery][]. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass [PredictResponse.attribution_token][] as a URL parameter to product K's page. When recording events on product K's page, log the [PredictResponse.attribution_token][] to this field.

string attribution_token = 8;

Returns
TypeDescription
ByteString

The bytes for attributionToken.

getCompletionInfo()

public CompletionInfo getCompletionInfo()

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Returns
TypeDescription
CompletionInfo

The completionInfo.

getCompletionInfoBuilder()

public CompletionInfo.Builder getCompletionInfoBuilder()

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Returns
TypeDescription
CompletionInfo.Builder

getCompletionInfoOrBuilder()

public CompletionInfoOrBuilder getCompletionInfoOrBuilder()

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Returns
TypeDescription
CompletionInfoOrBuilder

getDefaultInstanceForType()

public UserEvent getDefaultInstanceForType()
Returns
TypeDescription
UserEvent

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getDirectUserRequest()

public boolean getDirectUserRequest()

Should set to true if the request is made directly from the end user, in which case the UserEvent.user_info.user_agent can be populated from the HTTP request. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events). This should not be set when using the JavaScript tag in UserEventService.CollectUserEvent.

bool direct_user_request = 5;

Returns
TypeDescription
boolean

The directUserRequest.

getDocuments(int index)

public DocumentInfo getDocuments(int index)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
indexint
Returns
TypeDescription
DocumentInfo

getDocumentsBuilder(int index)

public DocumentInfo.Builder getDocumentsBuilder(int index)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
indexint
Returns
TypeDescription
DocumentInfo.Builder

getDocumentsBuilderList()

public List<DocumentInfo.Builder> getDocumentsBuilderList()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
List<Builder>

getDocumentsCount()

public int getDocumentsCount()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
int

getDocumentsList()

public List<DocumentInfo> getDocumentsList()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
List<DocumentInfo>

getDocumentsOrBuilder(int index)

public DocumentInfoOrBuilder getDocumentsOrBuilder(int index)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
indexint
Returns
TypeDescription
DocumentInfoOrBuilder

getDocumentsOrBuilderList()

public List<? extends DocumentInfoOrBuilder> getDocumentsOrBuilderList()

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Returns
TypeDescription
List<? extends com.google.cloud.discoveryengine.v1beta.DocumentInfoOrBuilder>

getEventTime()

public Timestamp getEventTime()

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Returns
TypeDescription
Timestamp

The eventTime.

getEventTimeBuilder()

public Timestamp.Builder getEventTimeBuilder()

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Returns
TypeDescription
Builder

getEventTimeOrBuilder()

public TimestampOrBuilder getEventTimeOrBuilder()

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Returns
TypeDescription
TimestampOrBuilder

getEventType()

public String getEventType()

Required. User event type. Allowed values are: Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans Retail-related values:
  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s) Media-related values:
  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.

string event_type = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The eventType.

getEventTypeBytes()

public ByteString getEventTypeBytes()

Required. User event type. Allowed values are: Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans Retail-related values:
  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s) Media-related values:
  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.

string event_type = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for eventType.

getFilter()

public String getFilter()

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for search events, the associated [SearchService.SearchRequest][] may contain a filter expression in [SearchService.SearchRequest.filter][] conforming to https://google.aip.dev/160#filtering. Similarly, for view-item-list events that are generated from a [PredictionService.PredictRequest][], this field may be populated directly from [PredictionService.PredictRequest.filter][] conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string filter = 9;

Returns
TypeDescription
String

The filter.

getFilterBytes()

public ByteString getFilterBytes()

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for search events, the associated [SearchService.SearchRequest][] may contain a filter expression in [SearchService.SearchRequest.filter][] conforming to https://google.aip.dev/160#filtering. Similarly, for view-item-list events that are generated from a [PredictionService.PredictRequest][], this field may be populated directly from [PredictionService.PredictRequest.filter][] conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string filter = 9;

Returns
TypeDescription
ByteString

The bytes for filter.

getMediaInfo()

public MediaInfo getMediaInfo()

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Returns
TypeDescription
MediaInfo

The mediaInfo.

getMediaInfoBuilder()

public MediaInfo.Builder getMediaInfoBuilder()

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Returns
TypeDescription
MediaInfo.Builder

getMediaInfoOrBuilder()

public MediaInfoOrBuilder getMediaInfoOrBuilder()

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Returns
TypeDescription
MediaInfoOrBuilder

getMutableAttributes()

public Map<String,CustomAttribute> getMutableAttributes()

Use alternate mutation accessors instead.

Returns
TypeDescription
Map<String,CustomAttribute>

getPageInfo()

public PageInfo getPageInfo()

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Returns
TypeDescription
PageInfo

The pageInfo.

getPageInfoBuilder()

public PageInfo.Builder getPageInfoBuilder()

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Returns
TypeDescription
PageInfo.Builder

getPageInfoOrBuilder()

public PageInfoOrBuilder getPageInfoOrBuilder()

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Returns
TypeDescription
PageInfoOrBuilder

getPanel()

public PanelInfo getPanel()

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Returns
TypeDescription
PanelInfo

The panel.

getPanelBuilder()

public PanelInfo.Builder getPanelBuilder()

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Returns
TypeDescription
PanelInfo.Builder

getPanelOrBuilder()

public PanelInfoOrBuilder getPanelOrBuilder()

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Returns
TypeDescription
PanelInfoOrBuilder

getPromotionIds(int index)

public String getPromotionIds(int index)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
String

The promotionIds at the given index.

getPromotionIdsBytes(int index)

public ByteString getPromotionIdsBytes(int index)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
ByteString

The bytes of the promotionIds at the given index.

getPromotionIdsCount()

public int getPromotionIdsCount()

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Returns
TypeDescription
int

The count of promotionIds.

getPromotionIdsList()

public ProtocolStringList getPromotionIdsList()

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Returns
TypeDescription
ProtocolStringList

A list containing the promotionIds.

getSearchInfo()

public SearchInfo getSearchInfo()

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Returns
TypeDescription
SearchInfo

The searchInfo.

getSearchInfoBuilder()

public SearchInfo.Builder getSearchInfoBuilder()

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Returns
TypeDescription
SearchInfo.Builder

getSearchInfoOrBuilder()

public SearchInfoOrBuilder getSearchInfoOrBuilder()

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Returns
TypeDescription
SearchInfoOrBuilder

getSessionId()

public String getSessionId()

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sesion_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.

string session_id = 6;

Returns
TypeDescription
String

The sessionId.

getSessionIdBytes()

public ByteString getSessionIdBytes()

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sesion_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.

string session_id = 6;

Returns
TypeDescription
ByteString

The bytes for sessionId.

getTagIds(int index)

public String getTagIds(int index)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
String

The tagIds at the given index.

getTagIdsBytes(int index)

public ByteString getTagIdsBytes(int index)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
ByteString

The bytes of the tagIds at the given index.

getTagIdsCount()

public int getTagIdsCount()

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Returns
TypeDescription
int

The count of tagIds.

getTagIdsList()

public ProtocolStringList getTagIdsList()

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Returns
TypeDescription
ProtocolStringList

A list containing the tagIds.

getTransactionInfo()

public TransactionInfo getTransactionInfo()

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Returns
TypeDescription
TransactionInfo

The transactionInfo.

getTransactionInfoBuilder()

public TransactionInfo.Builder getTransactionInfoBuilder()

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Returns
TypeDescription
TransactionInfo.Builder

getTransactionInfoOrBuilder()

public TransactionInfoOrBuilder getTransactionInfoOrBuilder()

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Returns
TypeDescription
TransactionInfoOrBuilder

getUserInfo()

public UserInfo getUserInfo()

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Returns
TypeDescription
UserInfo

The userInfo.

getUserInfoBuilder()

public UserInfo.Builder getUserInfoBuilder()

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Returns
TypeDescription
UserInfo.Builder

getUserInfoOrBuilder()

public UserInfoOrBuilder getUserInfoOrBuilder()

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Returns
TypeDescription
UserInfoOrBuilder

getUserPseudoId()

public String getUserPseudoId()

Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The userPseudoId.

getUserPseudoIdBytes()

public ByteString getUserPseudoIdBytes()

Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for userPseudoId.

hasCompletionInfo()

public boolean hasCompletionInfo()

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Returns
TypeDescription
boolean

Whether the completionInfo field is set.

hasEventTime()

public boolean hasEventTime()

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Returns
TypeDescription
boolean

Whether the eventTime field is set.

hasMediaInfo()

public boolean hasMediaInfo()

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Returns
TypeDescription
boolean

Whether the mediaInfo field is set.

hasPageInfo()

public boolean hasPageInfo()

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Returns
TypeDescription
boolean

Whether the pageInfo field is set.

hasPanel()

public boolean hasPanel()

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Returns
TypeDescription
boolean

Whether the panel field is set.

hasSearchInfo()

public boolean hasSearchInfo()

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Returns
TypeDescription
boolean

Whether the searchInfo field is set.

hasTransactionInfo()

public boolean hasTransactionInfo()

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Returns
TypeDescription
boolean

Whether the transactionInfo field is set.

hasUserInfo()

public boolean hasUserInfo()

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Returns
TypeDescription
boolean

Whether the userInfo field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeCompletionInfo(CompletionInfo value)

public UserEvent.Builder mergeCompletionInfo(CompletionInfo value)

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Parameter
NameDescription
valueCompletionInfo
Returns
TypeDescription
UserEvent.Builder

mergeEventTime(Timestamp value)

public UserEvent.Builder mergeEventTime(Timestamp value)

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
UserEvent.Builder

mergeFrom(UserEvent other)

public UserEvent.Builder mergeFrom(UserEvent other)
Parameter
NameDescription
otherUserEvent
Returns
TypeDescription
UserEvent.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public UserEvent.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
UserEvent.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public UserEvent.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
UserEvent.Builder
Overrides

mergeMediaInfo(MediaInfo value)

public UserEvent.Builder mergeMediaInfo(MediaInfo value)

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Parameter
NameDescription
valueMediaInfo
Returns
TypeDescription
UserEvent.Builder

mergePageInfo(PageInfo value)

public UserEvent.Builder mergePageInfo(PageInfo value)

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Parameter
NameDescription
valuePageInfo
Returns
TypeDescription
UserEvent.Builder

mergePanel(PanelInfo value)

public UserEvent.Builder mergePanel(PanelInfo value)

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Parameter
NameDescription
valuePanelInfo
Returns
TypeDescription
UserEvent.Builder

mergeSearchInfo(SearchInfo value)

public UserEvent.Builder mergeSearchInfo(SearchInfo value)

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Parameter
NameDescription
valueSearchInfo
Returns
TypeDescription
UserEvent.Builder

mergeTransactionInfo(TransactionInfo value)

public UserEvent.Builder mergeTransactionInfo(TransactionInfo value)

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Parameter
NameDescription
valueTransactionInfo
Returns
TypeDescription
UserEvent.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final UserEvent.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
UserEvent.Builder
Overrides

mergeUserInfo(UserInfo value)

public UserEvent.Builder mergeUserInfo(UserInfo value)

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Parameter
NameDescription
valueUserInfo
Returns
TypeDescription
UserEvent.Builder

putAllAttributes(Map<String,CustomAttribute> values)

public UserEvent.Builder putAllAttributes(Map<String,CustomAttribute> values)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameter
NameDescription
valuesMap<String,CustomAttribute>
Returns
TypeDescription
UserEvent.Builder

putAttributes(String key, CustomAttribute value)

public UserEvent.Builder putAttributes(String key, CustomAttribute value)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameters
NameDescription
keyString
valueCustomAttribute
Returns
TypeDescription
UserEvent.Builder

removeAttributes(String key)

public UserEvent.Builder removeAttributes(String key)

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the DiscoveryEngine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

map<string, .google.cloud.discoveryengine.v1beta.CustomAttribute> attributes = 17;

Parameter
NameDescription
keyString
Returns
TypeDescription
UserEvent.Builder

removeDocuments(int index)

public UserEvent.Builder removeDocuments(int index)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameter
NameDescription
indexint
Returns
TypeDescription
UserEvent.Builder

setAttributionToken(String value)

public UserEvent.Builder setAttributionToken(String value)

Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of [PredictionService.Predict][]. This field enables accurate attribution of recommendation model performance. The value must be one of:

  • [PredictResponse.attribution_token][] for events that are the result of [PredictionService.Predict][].
  • SearchResponse.attribution_token for events that are the result of [SearchService.Search][].
  • [CompleteQueryResponse.attribution_token][] for events that are the result of [SearchService.CompleteQuery][]. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass [PredictResponse.attribution_token][] as a URL parameter to product K's page. When recording events on product K's page, log the [PredictResponse.attribution_token][] to this field.

string attribution_token = 8;

Parameter
NameDescription
valueString

The attributionToken to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setAttributionTokenBytes(ByteString value)

public UserEvent.Builder setAttributionTokenBytes(ByteString value)

Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of [PredictionService.Predict][]. This field enables accurate attribution of recommendation model performance. The value must be one of:

  • [PredictResponse.attribution_token][] for events that are the result of [PredictionService.Predict][].
  • SearchResponse.attribution_token for events that are the result of [SearchService.Search][].
  • [CompleteQueryResponse.attribution_token][] for events that are the result of [SearchService.CompleteQuery][]. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass [PredictResponse.attribution_token][] as a URL parameter to product K's page. When recording events on product K's page, log the [PredictResponse.attribution_token][] to this field.

string attribution_token = 8;

Parameter
NameDescription
valueByteString

The bytes for attributionToken to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setCompletionInfo(CompletionInfo value)

public UserEvent.Builder setCompletionInfo(CompletionInfo value)

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Parameter
NameDescription
valueCompletionInfo
Returns
TypeDescription
UserEvent.Builder

setCompletionInfo(CompletionInfo.Builder builderForValue)

public UserEvent.Builder setCompletionInfo(CompletionInfo.Builder builderForValue)

CompleteQuery API details related to the event. This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

.google.cloud.discoveryengine.v1beta.CompletionInfo completion_info = 13;

Parameter
NameDescription
builderForValueCompletionInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setDirectUserRequest(boolean value)

public UserEvent.Builder setDirectUserRequest(boolean value)

Should set to true if the request is made directly from the end user, in which case the UserEvent.user_info.user_agent can be populated from the HTTP request. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events). This should not be set when using the JavaScript tag in UserEventService.CollectUserEvent.

bool direct_user_request = 5;

Parameter
NameDescription
valueboolean

The directUserRequest to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setDocuments(int index, DocumentInfo value)

public UserEvent.Builder setDocuments(int index, DocumentInfo value)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameters
NameDescription
indexint
valueDocumentInfo
Returns
TypeDescription
UserEvent.Builder

setDocuments(int index, DocumentInfo.Builder builderForValue)

public UserEvent.Builder setDocuments(int index, DocumentInfo.Builder builderForValue)

List of Documents associated with this user event. This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

repeated .google.cloud.discoveryengine.v1beta.DocumentInfo documents = 10;

Parameters
NameDescription
indexint
builderForValueDocumentInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setEventTime(Timestamp value)

public UserEvent.Builder setEventTime(Timestamp value)

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
UserEvent.Builder

setEventTime(Timestamp.Builder builderForValue)

public UserEvent.Builder setEventTime(Timestamp.Builder builderForValue)

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

.google.protobuf.Timestamp event_time = 3;

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
UserEvent.Builder

setEventType(String value)

public UserEvent.Builder setEventType(String value)

Required. User event type. Allowed values are: Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans Retail-related values:
  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s) Media-related values:
  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.

string event_type = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The eventType to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setEventTypeBytes(ByteString value)

public UserEvent.Builder setEventTypeBytes(ByteString value)

Required. User event type. Allowed values are: Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans Retail-related values:
  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s) Media-related values:
  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.

string event_type = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes for eventType to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public UserEvent.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
UserEvent.Builder
Overrides

setFilter(String value)

public UserEvent.Builder setFilter(String value)

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for search events, the associated [SearchService.SearchRequest][] may contain a filter expression in [SearchService.SearchRequest.filter][] conforming to https://google.aip.dev/160#filtering. Similarly, for view-item-list events that are generated from a [PredictionService.PredictRequest][], this field may be populated directly from [PredictionService.PredictRequest.filter][] conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string filter = 9;

Parameter
NameDescription
valueString

The filter to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setFilterBytes(ByteString value)

public UserEvent.Builder setFilterBytes(ByteString value)

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for search events, the associated [SearchService.SearchRequest][] may contain a filter expression in [SearchService.SearchRequest.filter][] conforming to https://google.aip.dev/160#filtering. Similarly, for view-item-list events that are generated from a [PredictionService.PredictRequest][], this field may be populated directly from [PredictionService.PredictRequest.filter][] conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string filter = 9;

Parameter
NameDescription
valueByteString

The bytes for filter to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setMediaInfo(MediaInfo value)

public UserEvent.Builder setMediaInfo(MediaInfo value)

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Parameter
NameDescription
valueMediaInfo
Returns
TypeDescription
UserEvent.Builder

setMediaInfo(MediaInfo.Builder builderForValue)

public UserEvent.Builder setMediaInfo(MediaInfo.Builder builderForValue)

Media-specific info.

.google.cloud.discoveryengine.v1beta.MediaInfo media_info = 18;

Parameter
NameDescription
builderForValueMediaInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setPageInfo(PageInfo value)

public UserEvent.Builder setPageInfo(PageInfo value)

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Parameter
NameDescription
valuePageInfo
Returns
TypeDescription
UserEvent.Builder

setPageInfo(PageInfo.Builder builderForValue)

public UserEvent.Builder setPageInfo(PageInfo.Builder builderForValue)

Page metadata such as categories and other critical information for certain event types such as view-category-page.

.google.cloud.discoveryengine.v1beta.PageInfo page_info = 7;

Parameter
NameDescription
builderForValuePageInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setPanel(PanelInfo value)

public UserEvent.Builder setPanel(PanelInfo value)

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Parameter
NameDescription
valuePanelInfo
Returns
TypeDescription
UserEvent.Builder

setPanel(PanelInfo.Builder builderForValue)

public UserEvent.Builder setPanel(PanelInfo.Builder builderForValue)

Panel metadata associated with this user event.

.google.cloud.discoveryengine.v1beta.PanelInfo panel = 11;

Parameter
NameDescription
builderForValuePanelInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setPromotionIds(int index, String value)

public UserEvent.Builder setPromotionIds(int index, String value)

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

repeated string promotion_ids = 16;

Parameters
NameDescription
indexint

The index to set the value at.

valueString

The promotionIds to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public UserEvent.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
UserEvent.Builder
Overrides

setSearchInfo(SearchInfo value)

public UserEvent.Builder setSearchInfo(SearchInfo value)

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Parameter
NameDescription
valueSearchInfo
Returns
TypeDescription
UserEvent.Builder

setSearchInfo(SearchInfo.Builder builderForValue)

public UserEvent.Builder setSearchInfo(SearchInfo.Builder builderForValue)

Search API details related to the event. This field should be set for search event.

.google.cloud.discoveryengine.v1beta.SearchInfo search_info = 12;

Parameter
NameDescription
builderForValueSearchInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setSessionId(String value)

public UserEvent.Builder setSessionId(String value)

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sesion_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.

string session_id = 6;

Parameter
NameDescription
valueString

The sessionId to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setSessionIdBytes(ByteString value)

public UserEvent.Builder setSessionIdBytes(ByteString value)

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sesion_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.

string session_id = 6;

Parameter
NameDescription
valueByteString

The bytes for sessionId to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setTagIds(int index, String value)

public UserEvent.Builder setTagIds(int index, String value)

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

repeated string tag_ids = 15;

Parameters
NameDescription
indexint

The index to set the value at.

valueString

The tagIds to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setTransactionInfo(TransactionInfo value)

public UserEvent.Builder setTransactionInfo(TransactionInfo value)

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Parameter
NameDescription
valueTransactionInfo
Returns
TypeDescription
UserEvent.Builder

setTransactionInfo(TransactionInfo.Builder builderForValue)

public UserEvent.Builder setTransactionInfo(TransactionInfo.Builder builderForValue)

The transaction metadata (if any) associated with this user event.

.google.cloud.discoveryengine.v1beta.TransactionInfo transaction_info = 14;

Parameter
NameDescription
builderForValueTransactionInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final UserEvent.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
UserEvent.Builder
Overrides

setUserInfo(UserInfo value)

public UserEvent.Builder setUserInfo(UserInfo value)

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Parameter
NameDescription
valueUserInfo
Returns
TypeDescription
UserEvent.Builder

setUserInfo(UserInfo.Builder builderForValue)

public UserEvent.Builder setUserInfo(UserInfo.Builder builderForValue)

Information about the end user.

.google.cloud.discoveryengine.v1beta.UserInfo user_info = 4;

Parameter
NameDescription
builderForValueUserInfo.Builder
Returns
TypeDescription
UserEvent.Builder

setUserPseudoId(String value)

public UserEvent.Builder setUserPseudoId(String value)

Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The userPseudoId to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.

setUserPseudoIdBytes(ByteString value)

public UserEvent.Builder setUserPseudoIdBytes(ByteString value)

Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes for userPseudoId to set.

Returns
TypeDescription
UserEvent.Builder

This builder for chaining.