Required for category-page-view events. Other event types should not set this field. The categories associated with a category page. Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: categories : ["Sales", "2017 Black Friday Deals"].
The main product details related to the event. This field is required for the following event types: * * add-to-cart * * add-to-list * * checkout-start * * detail-page-view * * purchase-complete * * refund * * remove-from-cart * * remove-from-list This field is optional for the following event types: * * page-visit * * shopping-cart-page-view - note that 'product_details' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types: * * category-page-view * * home-page-view * * search
↳ list_id
string
Required for add-to-list and remove-from-list events. The id or name of the list that the item is being added to or removed from. Other event types should not set this field.
↳ cart_id
string
Optional. The id or name of the associated shopping cart. This id is used to associate multiple items added or present in the cart before purchase. This can only be set for add-to-cart, remove-from-cart, checkout-start, purchase-complete, or shopping-cart-page-view events.
Optional. A transaction represents the entire purchase transaction. Required for purchase-complete events. Optional for checkout-start events. Other event types should not set this field.
getSearchQuery
Required for search events. Other event types should not set this field.
The user's search query as UTF-8 encoded text with a length limit of 5 KiB.
Returns
Type
Description
string
setSearchQuery
Required for search events. Other event types should not set this field.
The user's search query as UTF-8 encoded text with a length limit of 5 KiB.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPageCategories
Required for category-page-view events. Other event types should not set
this field.
The categories associated with a category page.
Category pages include special pages such as sales or promotions. For
instance, a special sale page may have the category hierarchy:
categories : ["Sales", "2017 Black Friday Deals"].
Required for category-page-view events. Other event types should not set
this field.
The categories associated with a category page.
Category pages include special pages such as sales or promotions. For
instance, a special sale page may have the category hierarchy:
categories : ["Sales", "2017 Black Friday Deals"].
This field is required for the following event types:
add-to-cart
add-to-list
checkout-start
detail-page-view
purchase-complete
refund
remove-from-cart
remove-from-list
This field is optional for the following event types:
page-visit
shopping-cart-page-view - note that 'product_details' should be set for
this unless the shopping cart is empty.
This field is not allowed for the following event types:
This field is required for the following event types:
add-to-cart
add-to-list
checkout-start
detail-page-view
purchase-complete
refund
remove-from-cart
remove-from-list
This field is optional for the following event types:
page-visit
shopping-cart-page-view - note that 'product_details' should be set for
this unless the shopping cart is empty.
This field is not allowed for the following event types:
Required for add-to-list and remove-from-list events. The id or name of
the list that the item is being added to or removed from. Other event types
should not set this field.
Returns
Type
Description
string
setListId
Required for add-to-list and remove-from-list events. The id or name of
the list that the item is being added to or removed from. Other event types
should not set this field.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getCartId
Optional. The id or name of the associated shopping cart. This id is used
to associate multiple items added or present in the cart before purchase.
This can only be set for add-to-cart, remove-from-cart,
checkout-start, purchase-complete, or shopping-cart-page-view events.
Returns
Type
Description
string
setCartId
Optional. The id or name of the associated shopping cart. This id is used
to associate multiple items added or present in the cart before purchase.
This can only be set for add-to-cart, remove-from-cart,
checkout-start, purchase-complete, or shopping-cart-page-view events.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPurchaseTransaction
Optional. A transaction represents the entire purchase transaction.
Required for purchase-complete events. Optional for checkout-start
events. Other event types should not set this field.
[[["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 ProductEventDetail (0.8.2)\n\nVersion latestkeyboard_arrow_down\n\n- [0.8.2 (latest)](/php/docs/reference/cloud-recommendations-ai/latest/V1beta1.ProductEventDetail)\n- [0.8.1](/php/docs/reference/cloud-recommendations-ai/0.8.1/V1beta1.ProductEventDetail)\n- [0.7.7](/php/docs/reference/cloud-recommendations-ai/0.7.7/V1beta1.ProductEventDetail)\n- [0.6.4](/php/docs/reference/cloud-recommendations-ai/0.6.4/V1beta1.ProductEventDetail)\n- [0.5.0](/php/docs/reference/cloud-recommendations-ai/0.5.0/V1beta1.ProductEventDetail)\n- [0.4.12](/php/docs/reference/cloud-recommendations-ai/0.4.12/V1beta1.ProductEventDetail) \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 ProductEventDetail.\n\nProductEventDetail captures user event information specific to retail\nproducts.\n\nGenerated from protobuf message `google.cloud.recommendationengine.v1beta1.ProductEventDetail`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ RecommendationEngine \\\\ V1beta1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getSearchQuery\n\nRequired for `search` events. Other event types should not set this field.\n\nThe user's search query as UTF-8 encoded text with a length limit of 5 KiB.\n\n### setSearchQuery\n\nRequired for `search` events. Other event types should not set this field.\n\nThe user's search query as UTF-8 encoded text with a length limit of 5 KiB.\n\n### getPageCategories\n\nRequired for `category-page-view` events. Other event types should not set\nthis field.\n\nThe categories associated with a category page.\nCategory pages include special pages such as sales or promotions. For\ninstance, a special sale page may have the category hierarchy:\ncategories : \\[\"Sales\", \"2017 Black Friday Deals\"\\].\n\n### setPageCategories\n\nRequired for `category-page-view` events. Other event types should not set\nthis field.\n\nThe categories associated with a category page.\nCategory pages include special pages such as sales or promotions. For\ninstance, a special sale page may have the category hierarchy:\ncategories : \\[\"Sales\", \"2017 Black Friday Deals\"\\].\n\n### getProductDetails\n\nThe main product details related to the event.\n\nThis field is required for the following event types:\n\n- `add-to-cart`\n- `add-to-list`\n- `checkout-start`\n- `detail-page-view`\n- `purchase-complete`\n- `refund`\n- `remove-from-cart`\n- `remove-from-list` This field is optional for the following event types:\n- `page-visit`\n- `shopping-cart-page-view` - note that 'product_details' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types:\n- `category-page-view`\n- `home-page-view`\n- `search`\n\n### setProductDetails\n\nThe main product details related to the event.\n\nThis field is required for the following event types:\n\n- `add-to-cart`\n- `add-to-list`\n- `checkout-start`\n- `detail-page-view`\n- `purchase-complete`\n- `refund`\n- `remove-from-cart`\n- `remove-from-list` This field is optional for the following event types:\n- `page-visit`\n- `shopping-cart-page-view` - note that 'product_details' should be set for this unless the shopping cart is empty. This field is not allowed for the following event types:\n- `category-page-view`\n- `home-page-view`\n- `search`\n\n### getListId\n\nRequired for `add-to-list` and `remove-from-list` events. The id or name of\nthe list that the item is being added to or removed from. Other event types\nshould not set this field.\n\n### setListId\n\nRequired for `add-to-list` and `remove-from-list` events. The id or name of\nthe list that the item is being added to or removed from. Other event types\nshould not set this field.\n\n### getCartId\n\nOptional. The id or name of the associated shopping cart. This id is used\nto associate multiple items added or present in the cart before purchase.\n\nThis can only be set for `add-to-cart`, `remove-from-cart`,\n`checkout-start`, `purchase-complete`, or `shopping-cart-page-view` events.\n\n### setCartId\n\nOptional. The id or name of the associated shopping cart. This id is used\nto associate multiple items added or present in the cart before purchase.\n\nThis can only be set for `add-to-cart`, `remove-from-cart`,\n`checkout-start`, `purchase-complete`, or `shopping-cart-page-view` events.\n\n### getPurchaseTransaction\n\nOptional. A transaction represents the entire purchase transaction.\n\nRequired for `purchase-complete` events. Optional for `checkout-start`\nevents. Other event types should not set this field.\n\n### hasPurchaseTransaction\n\n### clearPurchaseTransaction\n\n### setPurchaseTransaction\n\nOptional. A transaction represents the entire purchase transaction.\n\nRequired for `purchase-complete` events. Optional for `checkout-start`\nevents. Other event types should not set this field."]]