A message is published to this topic when a page has a view change or a context change. A view change means that the page type has changed, for example, from /home
to /checkout
. In this case, both the layout and the data change. A context change occurs when the page type remains the same but the data the page contains changes, for example, /product/prod1
to /product/prod2
.
$.Topic(PubSub.topicNames.PAGE_CHANGED).publish(pageEventData);
Arguments
pageEventData
: A JavaScript object that includes data related to the page change event, for example:
{ pageId:"category" contextId:"cat60041" seoslug:"controllers" previousContextId:"Product_36Exy" }
The properties in the JavaScript object include:
pageId
: An identifier for the page requested that represents either the page type (for example,product
,collection
,home
, and so on) or, for article pages, the page address that has been assigned in the Layout settings (for example,aboutUs
,shipping
, orreturns
, are all pages of typearticle
).contextId
: For contextual pages, acontextId
is included and it may be a product ID, category ID, an order ID, or an order confirmation ID. To determine the ID for a specific product or category, you can view the item’s details on the Catalog tab in Oracle Commerce Cloud Service. Order and order confirmation IDs are system-generated and cannot be known beforehand but you can check for their existence in the JSON object.seoslug
: An SEO-friendly, internally-generated name for the product or category, based on the product or category name. This property only has a value when changing to a product or category page.previousContextId
: The context ID, if one exists, for the page that was rendered before thePAGE_CHANGED
event occurred.
Memory enabled
Yes