The Compass Javascript library can be installed in landing pages to detect who is the Contact visited the page in order to personalize his experience. The snippet works only when the landing page has been reached from a link in a message sent via Campaigns.
How to
Step 1 - add the tracking keyword
To enable the tracking, you have to append the query string parameter to the link. For example, if you have the following HTML code:
<a href="https://www.mywebsite.com/mylandingpage.html"> Link text </a>
You have to add the query string c4w=C4W_TRACK_ME in the "href" attribute as follow:
<a href="https://www.mywebsite.com/mylandingpage.html?c4w=C4W_TRACK_ME"> Link text </a>
The C4W_TRACK_ME keyword will get automatically replaced by a generated token which the SDK will use to track the click.
Note: you can append the tracker to multiple links inside your message. The campaign reports will consider the message as "Clicked" when the user reaches the landing page from any of the tracked links inside the message, without distinction of which link the user has clicked.
Step 2 - add the web code to your landing page
The JS library is a simple javascript to be added to HTML code of the landing page of your links. Add the following code to the landing page to load the javascript that will record the tracking.
<script src="https://apps.cloud4wi.com/v2/clicktracker/main.js"></script>
If your website and landing pages uses a tag manager tool (such as Google Tag Manager) you can easily inject the JS library using it.
Step 3 - identify users
The SDK provides the JavaScript function setC4WCALLBACK
, that accepts a callback function. Use it to retrieve the hashed User ID, and you will be able to use it for any advanced tracking and personalization purpose.
setC4WCALLBACK(function(userId) {
console.log(userId);
});