Skip to main content

user_events

Creates, updates, deletes, gets or lists a user_events resource.

Overview

Nameuser_events
TypeResource
Idgoogle.recommendationengine.user_events

Fields

NameDatatypeDescription
eventDetailobjectUser event details shared by all recommendation types.
eventSourcestringOptional. This field should not be set when using JavaScript pixel or the Recommendations AI Tag. Defaults to EVENT_SOURCE_UNSPECIFIED.
eventTimestringOptional. Only required for ImportUserEvents method. Timestamp of user event created.
eventTypestringRequired. User event type. Allowed values are: add-to-cart Products being added to cart. add-to-list Items being added to a list (shopping list, favorites etc). category-page-view Special pages such as sale or promotion pages viewed. checkout-start User starting a checkout process. detail-page-view Products detail page viewed. home-page-view Homepage viewed. page-visit Generic page visits not included in the event types above. purchase-complete User finishing a purchase. refund Purchased items being refunded or returned. remove-from-cart Products being removed from cart. remove-from-list Items being removed from a list. search Product search. shopping-cart-page-view User viewing a shopping cart. impression List of items displayed. Used by Google Tag Manager.
productEventDetailobjectProductEventDetail captures user event information specific to retail products.
userInfoobjectInformation of end users.

Methods

NameAccessible byRequired ParamsDescription
projects_locations_catalogs_event_stores_user_events_listSELECTcatalogsId, eventStoresId, locationsId, projectsIdGets a list of user events within a time range, with potential filtering. The method does not list unjoined user events. Unjoined user event definition: when a user event is ingested from Recommendations AI User Event APIs, the catalog item included in the user event is connected with the current catalog. If a catalog item of the ingested event is not in the current catalog, it could lead to degraded model quality. This is called an unjoined event.
projects_locations_catalogs_event_stores_user_events_collectEXECcatalogsId, eventStoresId, locationsId, projectsIdWrites a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain. This method is used only by the Recommendations AI JavaScript pixel. Users should not call this method directly.
projects_locations_catalogs_event_stores_user_events_importEXECcatalogsId, eventStoresId, locationsId, projectsIdBulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.
projects_locations_catalogs_event_stores_user_events_purgeEXECcatalogsId, eventStoresId, locationsId, projectsIdDeletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.
projects_locations_catalogs_event_stores_user_events_rejoinEXECcatalogsId, eventStoresId, locationsId, projectsIdTriggers a user event rejoin operation with latest catalog data. Events will not be annotated with detailed catalog information if catalog item is missing at the time the user event is ingested, and these events are stored as unjoined events with a limited usage on training and serving. This API can be used to trigger a 'join' operation on specified events with latest version of catalog items. It can also be used to correct events joined with wrong catalog items.
projects_locations_catalogs_event_stores_user_events_writeEXECcatalogsId, eventStoresId, locationsId, projectsIdWrites a single user event.

SELECT examples

Gets a list of user events within a time range, with potential filtering. The method does not list unjoined user events. Unjoined user event definition: when a user event is ingested from Recommendations AI User Event APIs, the catalog item included in the user event is connected with the current catalog. If a catalog item of the ingested event is not in the current catalog, it could lead to degraded model quality. This is called an unjoined event.

SELECT
eventDetail,
eventSource,
eventTime,
eventType,
productEventDetail,
userInfo
FROM google.recommendationengine.user_events
WHERE catalogsId = '{{ catalogsId }}'
AND eventStoresId = '{{ eventStoresId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';