Tracking Implementation Guide
Getting you up to speed with the required tracking you'll need to make full use of our Product Discovery features.
If you are using (XO) Recommendations: To kickstart the algorithms we would highly recommend providing a sales history as described here: Sales History
Activity | When to trigger | Mandatory |
---|---|---|
Click | When a user clicks on a product. | |
Click on Search Result | When a user clicks on a product from an SRP. | |
View | When a user views a PDP. | |
View on Search Result/Navigation | When a user views a product directly from an SRP/PLP. | |
Add to Cart | When a user adds a product to their cart directly from a PDP page. | |
Add to Cart on Search Result/Navigation | When a user adds a product to their cart directly from an SRP/PLP. | |
Remove from Cart | When a user removes a product from their cart. | |
Purchase/Buy | When a user purchases an item. (These must be sent per item within an order). |
Activity Structure
More information regarding the activity structure can be found here: What is an Activity
Activities are composed of the following structure:
Mandatory fields
When sending an activity it is fundamental that the following fields are always populated:
Field | Type | Description |
---|---|---|
action | String | This is the type of action the user has performed, this can be: - click - view - add-to-cart - purchase |
target | Object | The target of the users action, this can be either a product or page i.e. {"product": "productId"} OR {"page": "fullPagePath"}. |
sourceId | String | The id of the previous request on the page used to fetch the data. For example, if the request is made on a PLP this will be the id of the request used to drive that PLP. |
user.identities | Object | The ids used to distinguish a customer, this can be: {"ecommerceId": "customerId"} Please discuss how you distinguish your customers with your TC to set this up appropriately. |
Please see Managing identitiesfor further information on what is stored in the user object.
Non-mandatory fields
Field | Type | Description |
---|---|---|
metadata | Object | This is populated with information required for the activity to function. Below you will find what metafields are required for each activity type. |
Metadata Object
The metadata object can contain the following variables:
Field | Type | Description |
---|---|---|
quantity | Integer | The number of products a customer has bought. |
orderId | String | The id of the order made. |
widgetId | String | The id of the widget called to fetch the recommendations. |
locale | String | The locale of the store e.g. "en_GB". |
price | Integer | The price of the product in cents/pence. If you use a float/currency type please be sure to times by 100. |
currency | String | The currency type e.g. "USD". |
You can also use metadata to store additional information about the activity.
Examples
Basic Activity Example Requests
Click
Triggered when a user clicks on a product
View
Triggered when a user clicks on a product
Add to Cart
Trigger when a user adds a product to their cart
Remove from Cart
Purchase
Triggered when a user purchases an item - this must be sent per product id
XO Specific Activity Examples
Triggered when a user clicks on a product within a widget
FHR Specific Activity Examples
Triggered when a user clicks on a campaign
Triggered when a user clicks on a facet
API
Regardless of the method of implementation, the following API call will subsequently be made:
Send activity
POST
https://collect-eu.attraqt.io/:trackerKey
Send an activity to the API
Path Parameters
Name | Type | Description |
---|---|---|
trackerKey | String | Tracker key uniquely identifying the application. |
Request Body
Name | Type | Description |
---|---|---|
target | object | The target of the action |
action | String | The user's action on the website |
user | object | User object (traits, segments and identities) |
sourceId | String | If the action is on a search result or a recommendation, then send the sourceId - responseId in FHR or recommendationId in XO |
metadata | String | All additional contextual data on the performed action |
segments | String | List of segments, usually for describing the client |
timestamp | String | Timestamp in ISO format |
Response
Unless you have AI Scores enabled, the response body will be as the above.
For more information regarding the AI scores response, please see here.
Feature Tracking Checklist
To be sure you have everything you need per feature please see the checklists below.
XO Recommendations Metrics
Fredhopper/Insights
AI Scores
Last updated