Reference documentation and code samples for the Google Cloud Recommendation Engine V1beta1 Client class UserEvent.
UserEvent captures all metadata information recommendation engine needs to
know about how end users interact with customers' website.
Generated from protobuf message google.cloud.recommendationengine.v1beta1.UserEvent
Namespace
Google \ Cloud \ RecommendationEngine \ V1beta1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ event_type
string
Required. 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.
Optional. Retail product specific user event metadata. This field is required for the following event types: * * add-to-cart * * add-to-list * * category-page-view * * checkout-start * * detail-page-view * * purchase-complete * * refund * * remove-from-cart * * remove-from-list * * search This field is optional for the following event types: * * page-visit * * shopping-cart-page-view - note that 'product_event_detail' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types: * * home-page-view
Optional. Retail product specific user event metadata.
This field is required for the following event types:
add-to-cart
add-to-list
category-page-view
checkout-start
detail-page-view
purchase-complete
refund
remove-from-cart
remove-from-list
search
This field is optional for the following event types:
page-visit
shopping-cart-page-view - note that 'product_event_detail' should be
set for this unless the shopping cart is empty.
This field is not allowed for the following event types:
Optional. Retail product specific user event metadata.
This field is required for the following event types:
add-to-cart
add-to-list
category-page-view
checkout-start
detail-page-view
purchase-complete
refund
remove-from-cart
remove-from-list
search
This field is optional for the following event types:
page-visit
shopping-cart-page-view - note that 'product_event_detail' should be
set for this unless the shopping cart is empty.
This field is not allowed for the following event types:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Google Cloud Recommendation Engine V1beta1 Client - Class UserEvent (0.8.2)\n\nVersion latestkeyboard_arrow_down\n\n- [0.8.2 (latest)](/php/docs/reference/cloud-recommendations-ai/latest/V1beta1.UserEvent)\n- [0.8.1](/php/docs/reference/cloud-recommendations-ai/0.8.1/V1beta1.UserEvent)\n- [0.7.7](/php/docs/reference/cloud-recommendations-ai/0.7.7/V1beta1.UserEvent)\n- [0.6.4](/php/docs/reference/cloud-recommendations-ai/0.6.4/V1beta1.UserEvent)\n- [0.5.0](/php/docs/reference/cloud-recommendations-ai/0.5.0/V1beta1.UserEvent)\n- [0.4.12](/php/docs/reference/cloud-recommendations-ai/0.4.12/V1beta1.UserEvent) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Cloud Recommendation Engine V1beta1 Client class UserEvent.\n\nUserEvent captures all metadata information recommendation engine needs to\nknow about how end users interact with customers' website.\n\nGenerated from protobuf message `google.cloud.recommendationengine.v1beta1.UserEvent`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ RecommendationEngine \\\\ V1beta1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getEventType\n\nRequired. User event type. Allowed values are:\n\n- `add-to-cart` Products being added to cart.\n\n- `add-to-list` Items being added to a list (shopping list, favorites\n etc).\n\n- `category-page-view` Special pages such as sale or promotion pages viewed.\n- `checkout-start` User starting a checkout process.\n- `detail-page-view` Products detail page viewed.\n- `home-page-view` Homepage viewed.\n- `page-visit` Generic page visits not included in the event types above.\n- `purchase-complete` User finishing a purchase.\n- `refund` Purchased items being refunded or returned.\n- `remove-from-cart` Products being removed from cart.\n- `remove-from-list` Items being removed from a list.\n- `search` Product search.\n- `shopping-cart-page-view` User viewing a shopping cart.\n- `impression` List of items displayed. Used by Google Tag Manager.\n\n### setEventType\n\nRequired. User event type. Allowed values are:\n\n- `add-to-cart` Products being added to cart.\n\n- `add-to-list` Items being added to a list (shopping list, favorites\n etc).\n\n- `category-page-view` Special pages such as sale or promotion pages viewed.\n- `checkout-start` User starting a checkout process.\n- `detail-page-view` Products detail page viewed.\n- `home-page-view` Homepage viewed.\n- `page-visit` Generic page visits not included in the event types above.\n- `purchase-complete` User finishing a purchase.\n- `refund` Purchased items being refunded or returned.\n- `remove-from-cart` Products being removed from cart.\n- `remove-from-list` Items being removed from a list.\n- `search` Product search.\n- `shopping-cart-page-view` User viewing a shopping cart.\n- `impression` List of items displayed. Used by Google Tag Manager.\n\n### getUserInfo\n\nRequired. User information.\n\n### hasUserInfo\n\n### clearUserInfo\n\n### setUserInfo\n\nRequired. User information.\n\n### getEventDetail\n\nOptional. User event detailed information common across different\nrecommendation types.\n\n### hasEventDetail\n\n### clearEventDetail\n\n### setEventDetail\n\nOptional. User event detailed information common across different\nrecommendation types.\n\n### getProductEventDetail\n\nOptional. Retail product specific user event metadata.\n\nThis field is required for the following event types:\n\n- `add-to-cart`\n- `add-to-list`\n- `category-page-view`\n- `checkout-start`\n- `detail-page-view`\n- `purchase-complete`\n- `refund`\n- `remove-from-cart`\n- `remove-from-list`\n- `search` This field is optional for the following event types:\n- `page-visit`\n- `shopping-cart-page-view` - note that 'product_event_detail' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types:\n- `home-page-view`\n\n### hasProductEventDetail\n\n### clearProductEventDetail\n\n### setProductEventDetail\n\nOptional. Retail product specific user event metadata.\n\nThis field is required for the following event types:\n\n- `add-to-cart`\n- `add-to-list`\n- `category-page-view`\n- `checkout-start`\n- `detail-page-view`\n- `purchase-complete`\n- `refund`\n- `remove-from-cart`\n- `remove-from-list`\n- `search` This field is optional for the following event types:\n- `page-visit`\n- `shopping-cart-page-view` - note that 'product_event_detail' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types:\n- `home-page-view`\n\n### getEventTime\n\nOptional. Only required for ImportUserEvents method. Timestamp of user\nevent created.\n\n### hasEventTime\n\n### clearEventTime\n\n### setEventTime\n\nOptional. Only required for ImportUserEvents method. Timestamp of user\nevent created.\n\n### getEventSource\n\nOptional. This field should *not* be set when using JavaScript pixel\nor the Recommendations AI Tag. Defaults to `EVENT_SOURCE_UNSPECIFIED`.\n\n### setEventSource\n\nOptional. This field should *not* be set when using JavaScript pixel\nor the Recommendations AI Tag. Defaults to `EVENT_SOURCE_UNSPECIFIED`."]]