Track events with yct.js¶
If you want the
userid to be generated automatically, leave out the user
params in the
If a predefined cookie already exists, it is used.
Otherwise a new one is created.
Tracking code quickstart¶
To use this mechanism on your pages, copy the code snippet below, and replace
<YOUR_MANDATOR_ID> with the customer ID,
<PAGE_ID> with the page/item identifier
<USER_ID> with the one generated by your user identifier.
All identifiers can be any form of string.
Paste this snippet into your website template page so that it appears before
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
_ycq object is what makes the asynchronous syntax possible.
It acts as a queue, which is a "first-in, first-out" (FIFO) data structure that
collects API calls until
yct.js is ready to run them.
To add to the queue, use the
_ycq global object can be used directly for asynchronous page tracking
_ycq object methods¶
Here is an example of typical usage of the method:
1 2 3
Tracker object names¶
||- Executed with one additional parameter:
||- Executed with four additional parameters:
|capturing an event:
||- Executed with five additional parameters:
|consume event sent after 20s:
||- Executed with two additional parameters: anonymous userId, pseudonymous userId.
- It is to be triggered when a user logs in and the tracking identity is changed.
||- If you want to send a click recommended event you can append the following parameter to the recommended item URLs:||https://mydomain.com/mypage.html?ycreco=true or
Tracking with HTML event handlers¶
The asynchronous tracking syntax should also be used from within DOM event handlers. For example, the following button generates an event when it is clicked:
Even if this button is clicked before the browser has finished loading
the event is captured and eventually executed.