Set up Event Tracking code to track events into CDP
I. MAIN SCRIPT
Add this script to the header tag of all the website pages that you want to track events (similar to what you have done with Google Analytics JS or Facebook Pixel JS.)
Example:
<!-- ANTSOMI SDK Analytics script -->
<script type = "text/javascript" >
var _portalId = "PORTAL_ID"; // Your Portal ID
var _propId = "PROPERTY_ID"; // Your Website Property ID
var _CDP_DELIVERY_TRIGGER=true;
(function() {
var w = window;
if (w.web_event) return;
var a = window.web_event = function() {
a.queue.push(arguments);
}
a.propId = _propId;
a.track = a;
a.queue = [];
var e = document.createElement("script");
e.type = "text/javascript", e.async = !0, e.src = "//st-a.cdp.asia/insight.js";
var t = document.getElementsByTagName("script")[0];
t.parentNode.insertBefore(e, t)
})(); </script>
<!-- End of ANTSOMI SDK Analytics script -->
How to get Main Script in CDP
Log into the CDP system
Go to menu: DATA HUB -> Event Sources
3. Select "Websites" Source, then go to "Setting" tab. You will be Main Script
II - EVENTS TRACKING
No
Event
Dimension
Event Type
Required
Trigger
1
Pageview / setPageConfig
page_type
page_category
Default
Yes
Default by SDK
Add to head tag all pages
set _cdp365Analytics
2
Product View
item: product
Ecommerce
Yes
Page loaded, User viewed a product details
3
Add to cart
item: product
Ecommerce
Yes
User added a product to their shopping cart
4
Remove from Cart
item: product
Ecommerce
Yes
User removed a product to their shopping cart
5
Cart view
item: product
Ecommerce
Yes
The user viewed their shopping cart
6
Cart checkout
item: product
Ecommerce
Yes
User-initiated the order process (a transaction is created)
7
Purchase
item: product
Ecommerce
Yes
User purchased and completed the order on the thank you page
8
Product Search
item: product
Ecommerce
Yes
User searched for products by keyword
9
User sign-In
Custom Event
Yes
User signed successful
10
User sign-Up
Custom Event
Yes
User signed successful
III - EVENTS TRACKING CODE
1. Pageview / setPageConfig:
Event trigger: Page loaded and add to head tag all pages
Code sample:
2. Product category page:
page_type : Fixed value to "category" (required)
page_category : The current category name. (required)
items: Top 5 highlight products (required)
Sample code tracking for the category page
type, id, and name are required params
The other params are optional, but there are a number of params that are required to serve the recommended product:
price
main_category
category_level_1
category_level_2
brand
3. Product detail page + product view
User viewed product details
page_type: Fixed value to "product_detail" (required)
page_category: The current category name of the product that you are viewing. (required)
items: The product detail (required)
Sample code tracking for the Product detail page + product view
type, id, and name are required params
The other params are optional, but there are a number of params that are required to serve the recommended product:
price
main_category
category_level_1
category_level_2
brand
4. Cart page + Cart view
User viewed product shopping cart
page_type : Fixed value to "cart" (required)
page_category : Fixed value to "cart" (required)
Sample code tracking for the category page
type, id, and name are required params
The other params are optional, but there are a number of params that are required to serve the recommended product: