Item Actions

The itemAction property of the Salesforce Interactions SDK is used to identify actions users take on catalog items such as "Purchase" or "AddToCart".

Item actions are a separate event property from regular actions (action). Item actions contain reserved action names used by Marketing Cloud Personalization to determine how to treat event data. Personalization automatically inserts the appropriate value for this property when sending events containing catalog data originating from matching a pageType mapped in the Sitemap code. Therefore, avoid manually mapping the itemAction property in your global or pageType configurations, except in the following scenarios.

When mapping pages with cart or order, you must specify itemAction in your pageType configuration. Typically the cart object is mapped only on the cart page itself with the itemAction value of "View Cart" (Evergage.ItemAction.ViewCart). Similarly, order is usually only mapped on the order confirmation page with the itemAction value of "Purchase" (Evergage.ItemAction.Purchase). If no lineItem is provided with the Purchase ItemAction, the SDK defaults to using the current state of the cart as line items.

The Item Actions documented in this article are available exclusively in the Evergage namespace. In the SalesforceInteractions namespace, Interactions replace Item Actions. For more information, refer to the Interaction Definitions documentation.

The item action property value needs to be manually set only when sending events to the Personalization platform using the event API. Only the reserved item action values within Evergage.ItemAction can be used. Within the context of the Sitemap, the event API is used to send an event independently of the page matching event using Evergage.sendEvent().

An example of an event sent using the API within the Sitemap can be found in our Example ecommerce Sitemap within the "product_detail" pageType configuration. The following code sample includes the relevant code block. In this example, a listener has been mapped containing an AddToCart event that fires when the user clicks the DOM element referenced by the provided selector, ".add-to-cart".

The possible values for item action are all contained within the Evergage.ItemAction object. Be sure to reference all values assigned to the itemAction property from the Evergage.ItemAction object in the same way as the AddToCart event detailed in the previous section.

  • Quick View Item - Similar to View Item but stops the timer for the "background" item and starts a timer for the "foreground" item.
  • Stop Quick View Item - Stops the timer initiated by the "Quick View Item" item action for the "foreground" item and restarts the timer for the "background" item.

Quick View Item and Stop Quick View Item are used to accurately track view time in cases where a user "views" an item while already viewing a different item. An ecommerce category page that allows users to view individual products in a window can take advantage of these item actions. In the following example, the "background" item is the category and the "foreground" item is the product. A new page load stops both timers.

While other Item Actions are present in the Evergage.ItemAction object, only the Item Actions documented here are currently supported. Unless otherwise indicated, the following definitions apply to both the page config and Event API.

Many item actions mentioned in the following definitions rely on events that contain line items. To learn more about the structure of the lineItem object, see the LineItem documentation.

View Item

View Item Detail

View Item Out Of Stock

Quick View Item

Stop Quick View Item

View Category

Add To Cart

When using this specific action, only one item is updated at a time. A single AddToCart event does not accept an array of items. If you want to add multiple items to the cart, the items need to be sent in multiple events.

View Cart

A viewCart event fully updates the items that a user has in their cart. For example, sending a viewCart event using Postman via the Event API overwrites any items currently saved in the user's cart.

Sitemap PageType Definition

Event API


Sitemap PageType Definition

Event API




Update Line Item

When using this specific action, only one item is updated at a time. A single UpdateLineItem event does not accept an array of items. If you want to update multiple cart items, you need to send in multiple events.

Remove From Cart