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 365 system. After logging in, look at the menu on the left hand side.
Hover your mouse over Data → Choose Event Sources

3. Select Websites Source, then go to Setting tab. You will see Main Script


II - EVENTS TRACKING
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
User signed successful
10
User sign-Up
User signed successful
III - EVENTS TRACKING CODE
1. Pageview / setPageConfig:
Code sample:
Event trigger: Page loaded and add to head tag all pages
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
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:
price
main_category
category_level_1
category_level_2
brand
5. Product search results page + product search events
page_type : Fixed value to "search" (required)
page_category : Fixed value to "search results" (required)
src_search_term: Search text keyword. (required)
Items: (required)
id : Product SKU , differentiate by Variant size
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
6. Thank you page + purchase event
page_type : Fixed value to "checkout" (required)
page_category : Fixed value to "thank_you" (required)
customer_id : will be the primary key in CDP. (required)
Example : MD5(phone_number), md5(email_address), …, etc
quantity: Product quantity (required)
is_web: Fixed value is true (required)
payment_method: an option of values 'OTC' ,…, etc (required)
Items: (required)
id : Product SKU , differentiate by Variant size
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
7. Add to cart
Items: (required)
id : Product SKU , differentiate by Variant size
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
8. Remove from cart
type: "product". fix this value (required)
Items: (required)
id : Product SKU , differentiate by Variant size
9. Cart checkout
customer_id : will be the primary key in CDP. (required)
Example : MD5(phone_number), md5(email_address), …, etc
payment_method: an option of values 'OTC' ,…, etc (required)
Items: (required)
id : Product SKU , differentiate by Variant size
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
10. User Sign-In
Event trigger: After the user login is successful.
customer_id : will be the primary key in CDP. (required)
Example : MD5(phone_number), md5(email_address), …, etc
identify_event: 'sign_in' . Fix this value (required)
customer_name (required)
11. User Sign-up
Event trigger: After the user sign-up is successful.
customer_id : will be the primary key in CDP.
Example : MD5(phone_number), md5(email_address), …, etc
identify_event: 'sign_up' . Fix this value
customer_name (required)
12. User Sign-out
When the user logout
13. Lead Form Submit and User Identify
Track a both of events when user submited form successfully
Set value for leadData with parameters exactly in code sample.
type, id, phone, and name are required params
IV. BLOG TRACKING EVENTS
1. Blog Category
Add this script to the header tag of the all blog pages - bellow the main code
page:
+ page_type: Fixed value to "article" (required)
+ page_category: The current article category name. (required)
Code sample
2. Blog Detail
Add this script to the header tag of the all blog pages - bellow the main code
Item product list size: The main article detail.
User viewed article details
page:
+ page_type: Fixed value to "article_detail" (required)
+ page_category: The current article category name. (required)
items:
+ type : Fixed value to "article" (required)
+ id: Article ID (required)
+ name: Article Title (required)
Code sample
Last updated