Intro
To track events JavaScript snippet needs to be added to all of your pages.
You can send the following recommended cart and custom events via snippet:
- added product to cart
- started checkout
- viewed product
- any custom event
Info
Ensure the contact is identified before sending events.Contact is identified if:
- Customer clicked on a campaign email and landed on your website
- Customer submitted Omnisend Form
- The
omnisend.identifyContact
function is used to identify the contact
$pageViewed event
$pageViewed event is used
for Live View Website Tracking.
To track page views, use JavaScript code line:
omnisend.push(["track", "$pageViewed"]);
Note 1: this code line is added to the default snippet code, so don't duplicate it.
Note 2: to use this functionality please use the newest JavaScript snippet code.
"viewed product" event
Fire viewed product event when a user views a product. This event is used for:
- Live View Website Tracking - to track product page views
- Product Abandonment automation - to use automated Product Abandonment workflow you also need to post products using Backend API.
- Product Picker - to add products into emails right from the store, without the need to manually copy paste anything.
Example of viewed product event code:
<script type="text/javascript">
omnisend.push([
"track",
"viewed product",
{
eventVersion: "v4",
eventID: "f1eeb5bd-736c-42c7-9cfe-6990f7f59b40",
origin: "api",
properties: {
product: {
id: 'prod666',
currency: 'USD',
price: 66.66,
oldPrice: 69.99,
title: 'Container',
description: 'Amazing container',
imageUrl: 'http://www.example.com/images/products/prod-666.png',
url: 'http://www.example.com/products/prod-666',
status: 'inStock',
categories: [
{
id: 'first',
title: 'containers'
}
]
}
}
}
]);
</script>
Properties
Property | Type | Mandatory | Description |
---|---|---|---|
eventVersion | string | Yes | Event version. Always pass "v4" |
origin | string | No | Which integration sends event. For custom store send "api" |
eventID | string | No | Event id (UUID v4). Use it for event deduplication |
properties.product.id | string | Yes | Product ID in shop |
properties.product.currency | string(3) | No | Currency ISO 4217 code |
properties.product.price | float | No | |
properties.product.oldPrice | float | No | |
properties.product.title | string | No | |
properties.product.description | string | No | Product description. We'll strip it to 30 words. |
properties.product.imageUrl | string | No | Link to product's image |
properties.product.url | string | No | Link to product's page |
properties.product.status | string | No | Status. Example: "inStock", "outOfStock", "notAvailable" |
properties.product.categories | array | No | |
properties.product.categories.[n].id | string | No | |
properties.product.categories.[n].title | string | No |
Note: to use this functionality please use the newest JavaScript snippet code.