This section lists all the events that you can track through the CDP WebTag Library. It also provides details about the payload that you must include for each event.
Key points about event tracking
- Each event’s payload contains required and optional attributes. The attributes vary depending on the event type. If an attribute is not applicable or the data is not available on certain pages, do not include these attributes.
- You can review the website or mobile app, and implement the appropriate events wherever they are relevant. For example, you must track a click on the Quick Add to Cart button through a
cartUpdated
event, a click on the Quick View button through aproductBrowsed
event, and an anonymous visitor filling a form with the email address could trigger alogin
event. The CDP implementation team can assist you to track the right events on your website or mobile app. - You must identify visitors on every event. You can send a
customer
entity along with each event on each object or entity at every call when possible. The attributes and values that you send to the SDK are case sensitive. For example, if you identify a customer’s email, you can send the following details to CDP:
var currentVisitor = $A1.Customer({ SourceCustomerNumber: "123", Email: “[email protected]” //”Email” with a capital “E” });
And not
var currentVisitor = $A1.Customer({ SourceCustomerNumber: "123", email: “[email protected]” //”email” with a lower case “e” });
- You must not initialize an object if you do not want to send that object. For example, if you are not planning to send transactions through the WebTag because they do not match the attributes, do not initialize a
$A1.Transaction({})
object. For more information on multiple source systems, see the warnings in CDP entities. CDP adds SourceTransactionNumber to the event object using targets. This way CDP does not add anything to the Transaction entity and adds information to Event and Customer entity with SourceTransactionNumber added to Event Entity. - In addition to the entities you are sending to CDP, the SDK collects the following additional information in each request.
- UserAgent - This will be collected off of the browser (if present).
- UserClient - This defaults to “B” (for “browser”).
List of events
In the following cases, you must set the SourceCustomerNumber or Email.
Event Name | Description | When to send it | Expected payload |
---|---|---|---|
login | Tracks users logging in to your website. | When the visitor logs in to your site. | A single event with at least a customer identifier (SourceCustomerNumber or Email ) |
productBrowsed | Tracks the product viewed by the visitor. | When the visitor views the details of a product on a product detail page, or through a “Quick View” functionality. | One event for each product viewed with a Target set with the corresponding SourceProductNumber attribute set. |
categoryBrowsed | Tracks the product category viewed by the visitor. | When the visitor is viewing a specific product category page. | One event for each category viewed, with the SourceProductCategoryNumber. attribute set |
cartUpdated | Tracks the content of the visitor’s cart. | When an item is added or removed from the cart, or when the cart is cleared. CDP does not consider the quantity in the cart for each item. An item is considered “added” if its quantity in the cart is greater than 0 and “removed” if the quantity is 0. | One event per cart update, with as many Targets as there are distinct products in the cart, with the corresponding SourceProductNumber attribute set. To represent a cart that has been cleared, send a unique cartUpdated event with one single Target with SourceProductNumber set to NULL . |
checkout | Tracks orders placed by the visitor. | When the visitor has paid and confirmed the transaction. | One event for the checkout, with or without a Transaction with the appropriate fields set (SourceTransactionNumber ), and any number of Targets for the related TransactionItems , that is, products included in the transaction, with the appropriate fields set (SourceTransactionItemNumber ). There are special cases where you may not want to send any transaction or transactionItem object, see Examples of web event tracking. |
onsiteSearch | Tracks the search term used by the visitor on your website. | When the visitor starts a search on your website. | A single event with the SearchTerm attribute set. |
logout | Tracks users logging out | When the visitor logs out of your site. | A single event with or without a customer identifier (SourceCustomerNumber or Email ). |
Next steps - Payload Examples
You can dig into the actual payloads that you must send to CDP to achieve the tracking. All of the events have example payloads documented and explained here, Examples of web event tracking.