Track Method
Overview
The track
method is used to track any user behaviour as event. You may track any behaviour that you would like to use to segment users in CrossEngage to use for campaigns. These can be anything from page views, completing purchases, viewing the cart, adjusting delivery preferences to changing a products' colors in an onsite configurator.
The track
method has the following structure:
Method Parameters
Value | Type | Description |
| string | The name of the event your are sending to CrossEngage. |
| object | Object that contains information about the event, see examples below. |
Implementation
Standard CrossEngage events
CrossEngage offers a range of predefined events which you can call without requiring any further event definition.
Viewed Product
A user views a specific product on your website:
Added Product / Removed product
A user adds a product or removes a product from their cart:
For all product-related events containing the cart object, the full current state of the cart should be passed, as the information in CrossEngage will be overwritten with each such event. The cart
object itself is not customisable, meaning no custom attributes (like cart.cartId
) can be added. Custom attributes can be added on the event's root level.
In addition, thesku
of the respective product should be provided on the top (root) level of the event data for all product-related events. This allows using this data with Product Feed events (Product Back/Low In Stock, Product Price Increased/Reduced) in real-time campaigns.
Searched Products
A user uses a search bar to look for products on your shop:
Completed Order
A user completes a purchase.
For each product in the products
array, CrossEngage will trigger an additional event namedOrdered Item
. This event can be used to easily segment users that have purchased a particular item.
Note that sku
is mandatory for each product in the products
array.
Sending Completed Order via Feed is recommended for historical event. Once your historical orders have been added to our system, Completed Order event is mostly done via API.
Viewed Cart
A user views their cart anywhere on your site. You can trigger this either on loading the full cart page or even a cart overlay that is triggered from the navigation bar.
Sending custom events
The CrossEngage web tracking library allows you to also send custom events through the track
method. To send custom events, please contact your dedicated Customer Success manager so that they can define these events and their properties for use within the CrossEngage platform.
To make it easier for us to prepare the events for you, please send your Customer Success manager the structure of the event in the following format:
The formats supported by CrossEngage are the following:
string
integer
float
datetime
array
object
Use cases
A user makes a purchase
Using the Completed Order
predefined CrossEngage event structure, call the track
method with the entire cart object, including all products in the cart at the time of purchase.
When a Completed Order
event is sent to CrossEngage, it will automatically trigger an Ordered Item
event for each of the products in the cart to allow you to easily segment users ordering particular products of a specific category or a within a specific price range.
To segment all users that have completed orders, create a segment condition filtering Completed Order
events. You may also use the event property cart.total
with the operator greater than
to additionally segment users that have completed an order over a given value.
A user views a cart overlay from the navbar of your site.
Using the Viewed Cart
predefined CrossEngage event structure, call the track
method with the entire cart object.
It is recommended that you send all products in the cart and all available product information to ensure that you gather all relevant data for segmentation purposes.
To segment all users that have viewed their cart, create a segment condition filtering Viewed Cart
events. You may also use the event property cart.total
with the operator greater than
to additionally segment only users viewing carts over a given amount.
A user changes the color of a shoe in an onsite configurator.
Contact your dedicated Customer Success manager and define a custom event called, for example, Colour Changed
with a structure as per below:
Once receiving confirmation that the event is ready for use, you may now call the track
method with a payload similar to the one below:
To segment all users that have changed their shoe color in an online configurator, create a segment condition filtering Colour Changed
events with the property category
using the equals
operator with the value shoes
.
Consider sending all the information that is relevant as this may be used for message personalization.
Last updated