Criteo Integration
Prerequisites
Before starting, you'll need:
- Your Criteo Partner ID (also called Account ID)
- Product IDs that match your Criteo product catalog
Find your Partner ID in your Criteo Commerce Growth Dashboard under Assets → Events Tracking. It's a 5-digit number.
Integrate Criteo with Consenter
Important: Before using this code, verify that the service ID and purpose ID values are up to date. These IDs are specific to your Consenter configuration. To find the correct IDs, go to Consenter Manager → Your Site → Active Banner → Hover over the service and purpose labels and click the copy button in the tooltip. See the Integration Guides page for detailed instructions.
Copy the code below and paste it into your website's <head> section.
Replace the placeholders with your own values:
YOUR_SERVICE_ID→ Your Criteo service ID from Consenter ManagerYOUR_PURPOSE_ID→ Your purpose ID from Consenter ManagerYOUR_PARTNER_ID→ Your 5-digit Criteo Partner/Account ID
<script>
var serviceId = "YOUR_SERVICE_ID"; // Replace with your service ID from Consenter Manager
var purposeId = "YOUR_PURPOSE_ID"; // Replace with your purpose ID from Consenter Manager
var partnerId = "YOUR_PARTNER_ID";
window.criteo_q = window.criteo_q || [];
function loadCriteo() {
var existingScript = document.querySelector(
'script[src*="criteo.com/js/ld/ld.js"]',
);
if (existingScript) return;
var script = document.createElement("script");
script.src = "//dynamic.criteo.com/js/ld/ld.js?a=" + partnerId;
script.async = true;
document.head.appendChild(script);
var deviceType = /iPad/.test(navigator.userAgent)
? "t"
: /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile/.test(
navigator.userAgent,
)
? "m"
: "d";
window.criteo_q.push(
{ event: "setAccount", account: partnerId },
{ event: "setSiteType", type: deviceType },
{ event: "viewHome" },
);
}
function removeCriteo() {
var scripts = document.querySelectorAll('script[src*="criteo.com"]');
scripts.forEach(function (script) {
script.remove();
});
window.criteo_q = [];
}
window.consenter.subscribe(
function (hasConsent) {
if (hasConsent) {
loadCriteo();
} else {
removeCriteo();
}
},
serviceId,
purposeId,
);
</script>Criteo is now connected to Consenter.
Last updated on