OneTag for Retail Media Offsite
Introduction
What is OneTag?
The Criteo OneTag is a code snippet to embed in your website's source code or tag management system. It measures and analyzes user interactions on your site. It also loads asynchronously, ensuring no impact on site performance or customer experience.
Common parameters
There are some common parameters which are shared between all the tags:
Event | key | example value | description |
---|---|---|---|
setAccount | account | 12345 | Your Criteo Account or Partner ID, provided by your technical contact, to route data to Criteo servers. |
setRetailerVisitorId | ID | 0193553C0A39937F23FC | A unique, unauthenticated user ID valid for at least 30 days. Used to track visitor behavior across sessions. Typically retrieved via a first-party cookie. |
setCustomerId | ID | 1SDFJI435FH12HFK2 | A consistent, internal ID for logged-in users, linked to accounts, purchase history, or membership programs. |
setEmail | d9c37700(...)18be88 | User’s email address in SHA256 hash format. |
Tags
Dynamic loader
Add the following script to all pages to load Criteo's JavaScript library, ensuring you populate the placeholder with your dedicated Criteo Partner ID:
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
Homepage tag
Trigger this tag on the homepage (http://www.retailer.com). Substitute all placeholders with actual values.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Homepage Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{ event: "viewHome" }
);
</script>
<!-- END Criteo Homepage Tag -->
Listing tag
Trigger this tag on all category pages (e.g., https://www.retailer.com/shopping/men) or search result pages. Substitute all placeholders with actual values.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Listing Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{
event: "viewList",
item: [
"123", // First item ID
"456", // Second item ID
"789" // Third item ID
]
}
);
</script>
<!-- END Criteo Listing Tag -->
Product tag
Use this tag on product pages (e.g., https://www.retailer.com/shopping/product-jacket-123456). Substitute all placeholders with actual values.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Product Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{ event: "viewItem", item: "ABC123" } // Product ID for the viewed item
);
</script>
<!-- END Criteo Product Tag -->
Add-to-cart tag
Trigger this tag when an item is added to the cart. Substitute all placeholders with actual values.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Add-to-cart Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{
event: "addToCart",
item: [
{
id: "ABC123", // Product ID
price: "49.99", // Product price
quantity: "2" // Quantity added to the cart
}
]
}
);
</script>
<!-- END Criteo Add-to-cart Tag -->
Basket tag
Use this tag on the basket page (https://www.retailer.com/basket). Substitute all placeholders with actual values, ensuring prices are the singular unitary price of each item.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Basket / Cart Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{
event: "viewBasket",
item: [
{
id: "ABC123", // Product ID
price: "49.99", // Product price
quantity: "2" // Quantity in the basket
},
{
id: "XYZ789", // Product ID for another item
price: "19.99", // Product price
quantity: "1" // Quantity in the basket
}
// Add a new object for each additional item in the cart
]
}
);
</script>
<!-- END Criteo Basket / Cart Tag -->
Conversion tag
Trigger this tag on the "Thank You" page post-purchase. Substitute all placeholders with actual values, ensuring prices are the singular unitary price of each item.
<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<!-- END Criteo Loader File -->
<!-- Criteo Conversion Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: "12345" }, // Your partner ID
{
event: "setEmail",
email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
},
{ event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
{ event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
{
event: "trackTransaction",
id: "TRX12345", // Transaction ID
item: [
{
id: "ABC123", // Product ID
price: "49.99", // Product price
quantity: "2" // Quantity purchased
},
{
id: "XYZ789", // Product ID for another item
price: "19.99", // Product price
quantity: "1" // Quantity purchased
}
// Add a new object for each additional purchased item
]
}
);
</script>
<!-- END Criteo Conversion Tag -->
Updated about 1 month ago