Class UserEvent.Builder (0.50.0)

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

UserEvent captures all metadata information Discovery Engine API needs to know about how end users interact with your website.

Protobuf type google.cloud.discoveryengine.v1beta.UserEvent

Implements

UserEventOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
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
Name Description
values Iterable<? extends com.google.cloud.discoveryengine.v1beta.DocumentInfo>
Returns
Type Description
UserEvent.Builder

addAllPanels(Iterable<? extends PanelInfo> values)

public UserEvent.Builder addAllPanels(Iterable<? extends PanelInfo> values)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Iterable<? extends com.google.cloud.discoveryengine.v1beta.PanelInfo>
Returns
Type Description
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
Name Description
values Iterable<String>

The promotionIds to add.

Returns
Type Description
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.

repeated string tag_ids = 15;

Parameter
Name Description
values Iterable<String>

The tagIds to add.

Returns
Type Description
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
Name Description
value DocumentInfo
Returns
Type Description
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
Name Description
builderForValue DocumentInfo.Builder
Returns
Type Description
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
Name Description
index int
value DocumentInfo
Returns
Type Description
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
Name Description
index int
builderForValue DocumentInfo.Builder
Returns
Type Description
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
Type Description
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
Name Description
index int
Returns
Type Description
DocumentInfo.Builder

addPanels(PanelInfo value)

public UserEvent.Builder addPanels(PanelInfo value)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value PanelInfo
Returns
Type Description
UserEvent.Builder

addPanels(PanelInfo.Builder builderForValue)

public UserEvent.Builder addPanels(PanelInfo.Builder builderForValue)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue PanelInfo.Builder
Returns
Type Description
UserEvent.Builder

addPanels(int index, PanelInfo value)

public UserEvent.Builder addPanels(int index, PanelInfo value)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value PanelInfo
Returns
Type Description
UserEvent.Builder

addPanels(int index, PanelInfo.Builder builderForValue)

public UserEvent.Builder addPanels(int index, PanelInfo.Builder builderForValue)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue PanelInfo.Builder
Returns
Type Description
UserEvent.Builder

addPanelsBuilder()

public PanelInfo.Builder addPanelsBuilder()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
PanelInfo.Builder

addPanelsBuilder(int index)

public PanelInfo.Builder addPanelsBuilder(int index)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
PanelInfo.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
Name Description
value String

The promotionIds to add.

Returns
Type Description
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
Name Description
value ByteString

The bytes of the promotionIds to add.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public UserEvent.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
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.

repeated string tag_ids = 15;

Parameter
Name Description
value String

The tagIds to add.

Returns
Type Description
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.

repeated string tag_ids = 15;

Parameter
Name Description
value ByteString

The bytes of the tagIds to add.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

build()

public UserEvent build()
Returns
Type Description
UserEvent

buildPartial()

public UserEvent buildPartial()
Returns
Type Description
UserEvent

clear()

public UserEvent.Builder clear()
Returns
Type Description
UserEvent.Builder
Overrides

clearAttributes()

public UserEvent.Builder clearAttributes()
Returns
Type Description
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 RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

  • RecommendResponse.attribution_token for events that are the result of RecommendationService.Recommend.
  • SearchResponse.attribution_token for events that are the result of SearchService.Search.

    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 RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

string attribution_token = 8;

Returns
Type Description
UserEvent.Builder

This builder for chaining.

clearCompletionInfo()

public UserEvent.Builder clearCompletionInfo()

CompletionService.CompleteQuery 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
Type Description
UserEvent.Builder

clearDataStore()

public UserEvent.Builder clearDataStore()

The DataStore resource full name, of the form projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}.

Optional. Only required for user events whose data store can't by determined by UserEvent.engine or UserEvent.documents. If data store is set in the parent of write/import/collect user event requests, this field can be omitted.

string data_store = 20 [(.google.api.resource_reference) = { ... }

Returns
Type Description
UserEvent.Builder

This builder for chaining.

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
Type Description
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
Type Description
UserEvent.Builder

clearEngine()

public UserEvent.Builder clearEngine()

The Engine resource name, in the form of projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Optional. Only required for Engine produced user events. For example, user events from blended search.

string engine = 19 [(.google.api.resource_reference) = { ... }

Returns
Type Description
UserEvent.Builder

This builder for chaining.

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
Type Description
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
  • add-feedback: Add a user feedback.

    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
Type Description
UserEvent.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public UserEvent.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
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 SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a RecommendRequest, this field may be populated directly from RecommendRequest.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
Type Description
UserEvent.Builder

This builder for chaining.

clearMediaInfo()

public UserEvent.Builder clearMediaInfo()

Media-specific info.

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

Returns
Type Description
UserEvent.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public UserEvent.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
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
Type Description
UserEvent.Builder

clearPanel()

public UserEvent.Builder clearPanel()

Panel metadata associated with this user event.

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

Returns
Type Description
UserEvent.Builder

clearPanels()

public UserEvent.Builder clearPanels()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
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
Type Description
UserEvent.Builder

This builder for chaining.

clearSearchInfo()

public UserEvent.Builder clearSearchInfo()

SearchService.Search details related to the event.

This field should be set for search event.

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

Returns
Type Description
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 session_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
Type Description
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.

repeated string tag_ids = 15;

Returns
Type Description
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
Type Description
UserEvent.Builder

clearUserInfo()

public UserEvent.Builder clearUserInfo()

Information about the end user.

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

Returns
Type Description
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
Type Description
UserEvent.Builder

This builder for chaining.

clone()

public UserEvent.Builder clone()
Returns
Type Description
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 Discovery Engine 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
Name Description
key String
Returns
Type Description
boolean

getAttributes() (deprecated)

public Map<String,CustomAttribute> getAttributes()

Use #getAttributesMap() instead.

Returns
Type Description
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 Discovery Engine 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
Type Description
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 Discovery Engine 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
Type Description
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 Discovery Engine 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
Name Description
key String
defaultValue CustomAttribute
Returns
Type Description
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 Discovery Engine 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
Name Description
key String
Returns
Type Description
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 RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

  • RecommendResponse.attribution_token for events that are the result of RecommendationService.Recommend.
  • SearchResponse.attribution_token for events that are the result of SearchService.Search.

    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 RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

string attribution_token = 8;

Returns
Type Description
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 RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

  • RecommendResponse.attribution_token for events that are the result of RecommendationService.Recommend.
  • SearchResponse.attribution_token for events that are the result of SearchService.Search.

    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 RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

string attribution_token = 8;

Returns
Type Description
ByteString

The bytes for attributionToken.

getCompletionInfo()

public CompletionInfo getCompletionInfo()

CompletionService.CompleteQuery 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
Type Description
CompletionInfo

The completionInfo.

getCompletionInfoBuilder()

public CompletionInfo.Builder getCompletionInfoBuilder()

CompletionService.CompleteQuery 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
Type Description
CompletionInfo.Builder

getCompletionInfoOrBuilder()

public CompletionInfoOrBuilder getCompletionInfoOrBuilder()

CompletionService.CompleteQuery 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
Type Description
CompletionInfoOrBuilder

getDataStore()

public String getDataStore()

The DataStore resource full name, of the form projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}.

Optional. Only required for user events whose data store can't by determined by UserEvent.engine or UserEvent.documents. If data store is set in the parent of write/import/collect user event requests, this field can be omitted.

string data_store = 20 [(.google.api.resource_reference) = { ... }

Returns
Type Description
String

The dataStore.

getDataStoreBytes()

public ByteString getDataStoreBytes()

The DataStore resource full name, of the form projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}.

Optional. Only required for user events whose data store can't by determined by UserEvent.engine or UserEvent.documents. If data store is set in the parent of write/import/collect user event requests, this field can be omitted.

string data_store = 20 [(.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for dataStore.

getDefaultInstanceForType()

public UserEvent getDefaultInstanceForType()
Returns
Type Description
UserEvent

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
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
Type Description
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
Name Description
index int
Returns
Type Description
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
Name Description
index int
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Name Description
index int
Returns
Type Description
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
Type Description
List<? extends com.google.cloud.discoveryengine.v1beta.DocumentInfoOrBuilder>

getEngine()

public String getEngine()

The Engine resource name, in the form of projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Optional. Only required for Engine produced user events. For example, user events from blended search.

string engine = 19 [(.google.api.resource_reference) = { ... }

Returns
Type Description
String

The engine.

getEngineBytes()

public ByteString getEngineBytes()

The Engine resource name, in the form of projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Optional. Only required for Engine produced user events. For example, user events from blended search.

string engine = 19 [(.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for engine.

getEventTime()

public Timestamp getEventTime()

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

.google.protobuf.Timestamp event_time = 3;

Returns
Type Description
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
Type Description
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
Type Description
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
  • add-feedback: Add a user feedback.

    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
Type Description
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
  • add-feedback: Add a user feedback.

    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
Type Description
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 SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a RecommendRequest, this field may be populated directly from RecommendRequest.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
Type Description
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 SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a RecommendRequest, this field may be populated directly from RecommendRequest.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
Type Description
ByteString

The bytes for filter.

getMediaInfo()

public MediaInfo getMediaInfo()

Media-specific info.

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

Returns
Type Description
MediaInfo

The mediaInfo.

getMediaInfoBuilder()

public MediaInfo.Builder getMediaInfoBuilder()

Media-specific info.

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

Returns
Type Description
MediaInfo.Builder

getMediaInfoOrBuilder()

public MediaInfoOrBuilder getMediaInfoOrBuilder()

Media-specific info.

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

Returns
Type Description
MediaInfoOrBuilder

getMutableAttributes() (deprecated)

public Map<String,CustomAttribute> getMutableAttributes()

Use alternate mutation accessors instead.

Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
PageInfoOrBuilder

getPanel()

public PanelInfo getPanel()

Panel metadata associated with this user event.

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

Returns
Type Description
PanelInfo

The panel.

getPanelBuilder()

public PanelInfo.Builder getPanelBuilder()

Panel metadata associated with this user event.

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

Returns
Type Description
PanelInfo.Builder

getPanelOrBuilder()

public PanelInfoOrBuilder getPanelOrBuilder()

Panel metadata associated with this user event.

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

Returns
Type Description
PanelInfoOrBuilder

getPanels(int index)

public PanelInfo getPanels(int index)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
PanelInfo

getPanelsBuilder(int index)

public PanelInfo.Builder getPanelsBuilder(int index)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
PanelInfo.Builder

getPanelsBuilderList()

public List<PanelInfo.Builder> getPanelsBuilderList()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Builder>

getPanelsCount()

public int getPanelsCount()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getPanelsList()

public List<PanelInfo> getPanelsList()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<PanelInfo>

getPanelsOrBuilder(int index)

public PanelInfoOrBuilder getPanelsOrBuilder(int index)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
PanelInfoOrBuilder

getPanelsOrBuilderList()

public List<? extends PanelInfoOrBuilder> getPanelsOrBuilderList()

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<? extends com.google.cloud.discoveryengine.v1beta.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
Name Description
index int

The index of the element to return.

Returns
Type Description
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
Name Description
index int

The index of the value to return.

Returns
Type Description
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
Type Description
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
Type Description
ProtocolStringList

A list containing the promotionIds.

getSearchInfo()

public SearchInfo getSearchInfo()

SearchService.Search details related to the event.

This field should be set for search event.

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

Returns
Type Description
SearchInfo

The searchInfo.

getSearchInfoBuilder()

public SearchInfo.Builder getSearchInfoBuilder()

SearchService.Search details related to the event.

This field should be set for search event.

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

Returns
Type Description
SearchInfo.Builder

getSearchInfoOrBuilder()

public SearchInfoOrBuilder getSearchInfoOrBuilder()

SearchService.Search details related to the event.

This field should be set for search event.

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

Returns
Type Description
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 session_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
Type Description
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 session_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
Type Description
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.

repeated string tag_ids = 15;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
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.

repeated string tag_ids = 15;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
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.

repeated string tag_ids = 15;

Returns
Type Description
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.

repeated string tag_ids = 15;

Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
TransactionInfoOrBuilder

getUserInfo()

public UserInfo getUserInfo()

Information about the end user.

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

Returns
Type Description
UserInfo

The userInfo.

getUserInfoBuilder()

public UserInfo.Builder getUserInfoBuilder()

Information about the end user.

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

Returns
Type Description
UserInfo.Builder

getUserInfoOrBuilder()

public UserInfoOrBuilder getUserInfoOrBuilder()

Information about the end user.

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

Returns
Type Description
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
Type Description
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
Type Description
ByteString

The bytes for userPseudoId.

hasCompletionInfo()

public boolean hasCompletionInfo()

CompletionService.CompleteQuery 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
Type Description
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
Type Description
boolean

Whether the eventTime field is set.

hasMediaInfo()

public boolean hasMediaInfo()

Media-specific info.

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

Returns
Type Description
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
Type Description
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
Type Description
boolean

Whether the panel field is set.

hasSearchInfo()

public boolean hasSearchInfo()

SearchService.Search details related to the event.

This field should be set for search event.

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

Returns
Type Description
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
Type Description
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
Type Description
boolean

Whether the userInfo field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCompletionInfo(CompletionInfo value)

public UserEvent.Builder mergeCompletionInfo(CompletionInfo value)

CompletionService.CompleteQuery 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
Name Description
value CompletionInfo
Returns
Type Description
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
Name Description
value Timestamp
Returns
Type Description
UserEvent.Builder

mergeFrom(UserEvent other)

public UserEvent.Builder mergeFrom(UserEvent other)
Parameter
Name Description
other UserEvent
Returns
Type Description
UserEvent.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public UserEvent.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UserEvent.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public UserEvent.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
UserEvent.Builder
Overrides

mergeMediaInfo(MediaInfo value)

public UserEvent.Builder mergeMediaInfo(MediaInfo value)

Media-specific info.

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

Parameter
Name Description
value MediaInfo
Returns
Type Description
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
Name Description
value PageInfo
Returns
Type Description
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
Name Description
value PanelInfo
Returns
Type Description
UserEvent.Builder

mergeSearchInfo(SearchInfo value)

public UserEvent.Builder mergeSearchInfo(SearchInfo value)

SearchService.Search details related to the event.

This field should be set for search event.

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

Parameter
Name Description
value SearchInfo
Returns
Type Description
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
Name Description
value TransactionInfo
Returns
Type Description
UserEvent.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final UserEvent.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
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
Name Description
value UserInfo
Returns
Type Description
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 Discovery Engine 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
Name Description
values Map<String,CustomAttribute>
Returns
Type Description
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 Discovery Engine 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
Name Description
key String
value CustomAttribute
Returns
Type Description
UserEvent.Builder

putAttributesBuilderIfAbsent(String key)

public CustomAttribute.Builder putAttributesBuilderIfAbsent(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 Discovery Engine 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
Name Description
key String
Returns
Type Description
CustomAttribute.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 Discovery Engine 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
Name Description
key String
Returns
Type Description
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
Name Description
index int
Returns
Type Description
UserEvent.Builder

removePanels(int index)

public UserEvent.Builder removePanels(int index)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
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 RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

  • RecommendResponse.attribution_token for events that are the result of RecommendationService.Recommend.
  • SearchResponse.attribution_token for events that are the result of SearchService.Search.

    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 RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

string attribution_token = 8;

Parameter
Name Description
value String

The attributionToken to set.

Returns
Type Description
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 RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

  • RecommendResponse.attribution_token for events that are the result of RecommendationService.Recommend.
  • SearchResponse.attribution_token for events that are the result of SearchService.Search.

    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 RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

string attribution_token = 8;

Parameter
Name Description
value ByteString

The bytes for attributionToken to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

setCompletionInfo(CompletionInfo value)

public UserEvent.Builder setCompletionInfo(CompletionInfo value)

CompletionService.CompleteQuery 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
Name Description
value CompletionInfo
Returns
Type Description
UserEvent.Builder

setCompletionInfo(CompletionInfo.Builder builderForValue)

public UserEvent.Builder setCompletionInfo(CompletionInfo.Builder builderForValue)

CompletionService.CompleteQuery 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
Name Description
builderForValue CompletionInfo.Builder
Returns
Type Description
UserEvent.Builder

setDataStore(String value)

public UserEvent.Builder setDataStore(String value)

The DataStore resource full name, of the form projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}.

Optional. Only required for user events whose data store can't by determined by UserEvent.engine or UserEvent.documents. If data store is set in the parent of write/import/collect user event requests, this field can be omitted.

string data_store = 20 [(.google.api.resource_reference) = { ... }

Parameter
Name Description
value String

The dataStore to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

setDataStoreBytes(ByteString value)

public UserEvent.Builder setDataStoreBytes(ByteString value)

The DataStore resource full name, of the form projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}.

Optional. Only required for user events whose data store can't by determined by UserEvent.engine or UserEvent.documents. If data store is set in the parent of write/import/collect user event requests, this field can be omitted.

string data_store = 20 [(.google.api.resource_reference) = { ... }

Parameter
Name Description
value ByteString

The bytes for dataStore to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

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
Name Description
value boolean

The directUserRequest to set.

Returns
Type Description
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
Name Description
index int
value DocumentInfo
Returns
Type Description
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
Name Description
index int
builderForValue DocumentInfo.Builder
Returns
Type Description
UserEvent.Builder

setEngine(String value)

public UserEvent.Builder setEngine(String value)

The Engine resource name, in the form of projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Optional. Only required for Engine produced user events. For example, user events from blended search.

string engine = 19 [(.google.api.resource_reference) = { ... }

Parameter
Name Description
value String

The engine to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

setEngineBytes(ByteString value)

public UserEvent.Builder setEngineBytes(ByteString value)

The Engine resource name, in the form of projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Optional. Only required for Engine produced user events. For example, user events from blended search.

string engine = 19 [(.google.api.resource_reference) = { ... }

Parameter
Name Description
value ByteString

The bytes for engine to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

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
Name Description
value Timestamp
Returns
Type Description
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
Name Description
builderForValue Builder
Returns
Type Description
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
  • add-feedback: Add a user feedback.

    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
Name Description
value String

The eventType to set.

Returns
Type Description
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
  • add-feedback: Add a user feedback.

    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
Name Description
value ByteString

The bytes for eventType to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public UserEvent.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
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 SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a RecommendRequest, this field may be populated directly from RecommendRequest.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
Name Description
value String

The filter to set.

Returns
Type Description
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 SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a RecommendRequest, this field may be populated directly from RecommendRequest.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
Name Description
value ByteString

The bytes for filter to set.

Returns
Type Description
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
Name Description
value MediaInfo
Returns
Type Description
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
Name Description
builderForValue MediaInfo.Builder
Returns
Type Description
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
Name Description
value PageInfo
Returns
Type Description
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
Name Description
builderForValue PageInfo.Builder
Returns
Type Description
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
Name Description
value PanelInfo
Returns
Type Description
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
Name Description
builderForValue PanelInfo.Builder
Returns
Type Description
UserEvent.Builder

setPanels(int index, PanelInfo value)

public UserEvent.Builder setPanels(int index, PanelInfo value)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value PanelInfo
Returns
Type Description
UserEvent.Builder

setPanels(int index, PanelInfo.Builder builderForValue)

public UserEvent.Builder setPanels(int index, PanelInfo.Builder builderForValue)

Optional. List of panels associated with this event. Used for page-level impression data.

repeated .google.cloud.discoveryengine.v1beta.PanelInfo panels = 22 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue PanelInfo.Builder
Returns
Type Description
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
Name Description
index int

The index to set the value at.

value String

The promotionIds to set.

Returns
Type Description
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
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
UserEvent.Builder
Overrides

setSearchInfo(SearchInfo value)

public UserEvent.Builder setSearchInfo(SearchInfo value)

SearchService.Search details related to the event.

This field should be set for search event.

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

Parameter
Name Description
value SearchInfo
Returns
Type Description
UserEvent.Builder

setSearchInfo(SearchInfo.Builder builderForValue)

public UserEvent.Builder setSearchInfo(SearchInfo.Builder builderForValue)

SearchService.Search details related to the event.

This field should be set for search event.

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

Parameter
Name Description
builderForValue SearchInfo.Builder
Returns
Type Description
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 session_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
Name Description
value String

The sessionId to set.

Returns
Type Description
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 session_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
Name Description
value ByteString

The bytes for sessionId to set.

Returns
Type Description
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.

repeated string tag_ids = 15;

Parameters
Name Description
index int

The index to set the value at.

value String

The tagIds to set.

Returns
Type Description
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
Name Description
value TransactionInfo
Returns
Type Description
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
Name Description
builderForValue TransactionInfo.Builder
Returns
Type Description
UserEvent.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final UserEvent.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
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
Name Description
value UserInfo
Returns
Type Description
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
Name Description
builderForValue UserInfo.Builder
Returns
Type Description
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
Name Description
value String

The userPseudoId to set.

Returns
Type Description
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
Name Description
value ByteString

The bytes for userPseudoId to set.

Returns
Type Description
UserEvent.Builder

This builder for chaining.