This document describes recommended practices for deploying and configuring the script.
On all pages where you want to track user actions, insert the following snippet before the closing </head> tag:
<script>
(function (w, d, s, l, u, i) {
w[l] = { project_url: u, project_id: i };
var f = d.getElementsByTagName(s)[0];
var j = d.createElement(s);
var t = new Date().getTime();
j.async = true;
j.type = 'module';
j.src = 'https://cdn.carecloud.cz/engagement/script.js?t=' + t;
f.parentNode.insertBefore(j, f);
w.ccce = w.ccce || [];
})(window, document, 'script', 'ccce_config', '${YOUR_PROJECT_URL}', '${YOUR_EXTERNAL_APPLICATION_ID}');
</script>
We recommend loading the script using Google Tag Manager while ensuring the appropriate cookie settings.
ccce interaction queue is created.${YOUR_PROJECT_URL} and ${YOUR_EXTERNAL_APPLICATION_ID}.To link actions with a specific customer, you need to send a login event after the user logs in.
<script type="text/javascript">
window.addEventListener('load', function () {
window.ccce = window.ccce || [];
window.ccce.push({
trigger: 'login',
data: {
contact_type: "customer_id",
contact_value: `${CUSTOMER_ID}`
}
})
});
</script>
contact_type valuescustomer_id → customer identifier from the CareCloud CRM & CDP system. Example: 8f9de85354bdb777ae1482019bemail → customer’s email address. Example: info@carecloud.czphone → customer’s phone number. Example: 420123456789external_id → object in the format:
{
"customer_source_id": "contact-source-id",
"external_id": "unique-id"
}
The script uses COOKIES
For debugging, you can enable debug mode:
w[l] = { project_url: u, project_id: i, debug: true };
window.ccce in the browser console.debug: true.project_url and project_id, disable debug.external_id<script type="text/javascript">
window.addEventListener('load', function () {
window.ccce = window.ccce || [];
window.ccce.push({
trigger: 'login',
data: {
contact_type: "external_id",
contact_value: {
customer_source_id: "eshop_system",
external_id: "usr_123456789"
}
}
})
});
</script>
During development, you can send events directly from the console:
window.ccce.push({
trigger: 'login',
data: {
contact_type: "email",
contact_value: "test@example.com"
}
});