If you are using the following supported ecommerce platforms:

  • Shopify
  • BigCommerce
  • EasyStore

Product Viewed and Cart Item Added can be configured to automatically track. For other platforms or custom activities, you need to use Web Tracking Javascript API to manually record contact activities.

Initialize OnVoard object

Specify the following snippet once before you add any javascript API code so that OnVoard object is initialized.

<script>
(function() {
window.OnVoard = window.OnVoard || function() {
(window.OnVoard.q = window.OnVoard.q || []).push(arguments);
};
})();
</script>

Identify Contact
Skip this command if Auto Track is turned on for supported ecommerce plaforms. For other platforms, this command is required so that we can identify contact to record activities.

// Either contact's ID or email must be provided.
// Pass name if you want to update.
var contactData = {};
contactData["id"] = "12345";
contactData["email"] = "john@example.com";
contactData["name"] = "John Doe";

OnVoard('web_tracking', 'identify', contactData);

 

Track Activities

For the example below, custom.wishlist_item_added is contact activity that we are recording for. You also need to pass record data based on properties from linked resource.

var data = {
"product_id": "56789",
"product_name": "Spiderman Mini",
"wishlist_id": "12345",
"wishlist_name": "Toy Collectibles"
}

OnVoard('web_tracking', 'track', 'custom.wishlist_item_added', data);

Skip the following fields for record data as they will be automatically augmented.

  • activity_id
  • activity_datetime
  • contact_id
  • contact_email

 Thus the actual recorded data will be something like:

{ 
"activity_id": "ctact_t5gehp1rpt8yjen7g5i7",
"activity_datetime": 1593739579,
"contact_id": "12345",
"contact_email": "john@example.com",

"product_id": "56789",
"product_name": "Spiderman Mini",
"wishlist_id": "12345",
"wishlist_name": "Toy Collectibles"
}