Criteo OneTag (Leads)¶
Overview¶
A guide to implement Criteo OneTag solution directly in your website source code. This guide is aimed at clients who intend to configure Criteo tracking to track and run Lead-based campaigns.
[[disclaimer-developer]]
Tags¶
Loader Script¶
The loader script tag is required to enable the rest of the Criteo OneTag events.
Kindly incorporate the script below within the
section of your website. This ensures it will be included across all pages. While it only requires a single activation per page, calling the script multiple times on a single page will not affect functionality.Field | Overview | Example | Syntax | Required |
---|---|---|---|---|
Partner ID | A numerical value that identifies your website account on the Criteo network. | 12345678 | Integer | Required |
Structure¶
<!-- Criteo Dynamic Loader -->
<script
type="text/javascript"
src="//dynamic.criteo.com/js/ld/ld.js?a={{accountid}}"
async="true"
></script>
<!-- END Criteo Dynamic Loader -->
Homepage Tag¶
Install the following tag on the homepage of your website. Example URL: {{homepageurl}}
Field | Overview | Example | Syntax | Required |
---|---|---|---|---|
Email Address | Email address in plain text (if allowed by the law in your country), sha256 hashed email address or MD5 hashed email address. | 79054025255fb1a26e4bc422aef54eb4... | - Plain text emails - Sha256 and md5 hashed emails |
Required |
Email Hash Method | The hashing method used for the email. - Doesn't need to be included for plain text emails - For sha265 hashed emails: "sha256" - For md5 hashed emails: "md5" |
sha256 | String | Required |
Phone Numbers | Phone numbers in plain text (if allowed by the law in your country), sha256 phone numbers. | fda66831d0cb0eb4bf... | - Plain text phone numbers - Sha256 hashed phone numbers |
Recommended |
Structure¶
Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events.
<!-- Criteo Homepage Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "viewHome" }
);
</script>
<!-- END Criteo Home Page Tag -->
Example¶
<!-- Criteo Homepage Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "viewHome" }
);
</script>
<!-- END Criteo Home Page Tag -->
Engagement Tag¶
Install the following tag on the key product pages and landing page(s) for the products you are looking to track and promote for the specific campaign. Example URL: {{homepageurl}}/product-landing-page.
Field | Overview | Example | Syntax | Required |
---|---|---|---|---|
Partner ID | A numerical value that identifies your website account on the Criteo network. | 12345678 | Integer | Required |
Email Address | Email address in plain text (if allowed by the law in your country), sha256 hashed email address or MD5 hashed email address. | 79054025255fb1a26e4bc422aef54eb4... | - Plain text emails - Sha256 and md5 hashed emails |
Required |
Email Hash Method | The hashing method used for the email. - Doesn't need to be included for plain text emails - For sha265 hashed emails: "sha256" - For md5 hashed emails: "md5" |
sha256 | String | Required |
Phone Numbers | Phone numbers in plain text (if allowed by the law in your country), sha256 phone numbers. | fda66831d0cb0eb4bf... | - Plain text phone numbers - Sha256 hashed phone numbers |
Recommended |
Product ID | Unique id of the product. You may hard-code this product id to a descriptive name as well. | a123 | String | Required |
Structure¶
Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events. Prefer SHA256 over MD5.
<!-- Criteo Engagement Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "viewItem", item: "##Product ID##" }
);
</script>
<!-- END Engagement Tag -->
Example¶
<!-- Criteo Engagement Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "viewItem", item: "a123" }
);
</script>
<!-- END Engagement Tag -->
Form / Pre-conversion Tag¶
Install the following tag on the pre-conversion or form page of your website. Example URL: {{homepageurl}}/sign-up/step1. If there is more than 1 page or steps in your pre-conversion / form, you may add the user_segment parameter to each tag, corresponding to the step in the form.
Field | Overview | Example | Syntax | Required |
---|---|---|---|---|
Partner ID | A numerical value that identifies your website account on the Criteo network. | 12345678 | Integer | Required |
Email Address | Email address in plain text (if allowed by the law in your country), sha256 hashed email address or MD5 hashed email address. | 79054025255fb1a26e4bc422aef54eb4... | - Plain text emails - Sha256 and md5 hashed emails |
Required |
Email Hash Method | The hashing method used for the email. - Doesn't need to be included for plain text emails - For sha265 hashed emails: "sha256" - For md5 hashed emails: "md5" |
sha256 | String | Required |
Phone Numbers | Phone numbers in plain text (if allowed by the law in your country), sha256 phone numbers. | fda66831d0cb0eb4bf... | - Plain text phone numbers - Sha256 hashed phone numbers |
Recommended |
Product ID | Unique id of the product. To ensure you can easily identify conversions in your Criteo reports, ensure you insert a product id, descriptive product or action name. Should this not be possible, you may set the Product ID to have value 1. | lead_xyz | String | Required |
user_segment | number of page or step in form. This is an optional field. | 1 | String or Integer | Optional |
Structure¶
Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events. Prefer SHA256 over MD5.
<!-- Criteo Form / Pre-conversion Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "viewBasket", user_segment : ##Step Number##, item: [
{id: "##Product Id##", price: "0", quantity: 1 }
]}
);
</script>
<!-- END Form / Pre-conversion Tag -->
Example¶
<!-- Criteo Form / Pre-conversion Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "viewBasket", user_segment : 1, item: [
{id: "lead_xyz", price: "0", quantity: 1 }
]}
);
</script>
<!-- END Form / Pre-conversion Tag -->
Conversion Tag¶
This tag records the conversions that happened on site. Install the following tag on the lead confirmation / thank you page of your website. Example URL: {{homepageurl}}/thankyou
Remember to fire this tag for ALL conversion events, regardless of attribution, so accurate implementation is essential for reliable tracking of performance metrics and to have more reliable audiences.
Field | Overview | Example | Syntax | Required |
---|---|---|---|---|
Partner ID | A numerical value that identifies your website account on the Criteo network. | 12345678 | Integer | Required |
Email Address | Email address in plain text (if allowed by the law in your country), sha256 hashed email address or MD5 hashed email address. | 79054025255fb1a26e4bc422aef54eb4... | - Plain text emails - Sha256 and md5 hashed emails |
Required |
Email Hash Method | The hashing method used for the email. - Doesn't need to be included for plain text emails - For sha265 hashed emails: "sha256" - For md5 hashed emails: "md5" |
sha256 | String | Required |
Phone Numbers | Phone numbers in plain text (if allowed by the law in your country), sha256 phone numbers. | fda66831d0cb0eb4bf... | - Plain text phone numbers - Sha256 hashed phone numbers |
Recommended |
Product ID | Unique id of the product. To ensure you can easily identify conversions in your Criteo reports, ensure you insert a product id, descriptive product or action name. Should this not be possible, you may set the Product ID to have value 1. | lead_xyz | String | Required |
Price* | CPA (Cost-per-acquisition) price | 1 | String or Integer, excluding the currency symbol | Required |
Transaction ID | Confirmation or Order # | 7654322 | String or Integer. Unique ID | Required |
- Send the price as "1": You wish to see the number of leads generated in $$$ (Default)
- Send a custom X price: You wish to specify a custom value for each lead
- Send the price as "0": You can choose this option if you wish to distinguish leads from sales or if you prefer not to display revenue for the leads.
Transaction ID format:
We advise that your website can generate a unique transaction id for each completed/confirmed lead and for this same to be sent to Criteo. This ensures that you will be able to identify every Criteo tracked conversion and match it with the individual user who originally generated the lead.
Should your website not generate and store such unique ID, we strongly recommend that the transaction id that is passed to Criteo, is in the same format of that sent to your Analytics. This helps with ensuring Criteo can optimise conversions based on your conversion data captured by your Analytics system (eg. Google Analytics 4).
Sending a random transaction ID is also possible, but it is least recommended, as you will not be able to match conversions between platforms unless the same ID is also stored your side by your website. To generate a randomized transaction id, you could pass a timestamp or a random number, commonly implemented in JavaScript like this: Math.floor(Math.random()*99999999999)+1
If the type of conversions that you want to track on your website are "New User Registrations", we recommend that you pass a "User ID" (Member ID) as the transaction id. This ensures that you can later match the individual referred registrations in the Criteo reporting and compare the numbers with your internal reports.
Should you have any doubt about this, contact your Criteo representative who will happily advise as to the best available option.
Structure¶
Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events. Prefer SHA256 over MD5.
<!-- Criteo Conversion Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType },
{ event: "trackTransaction", id: "##Transaction ID##", item: [
{id: "##Product Id##", price: "##Price##", quantity: 1 }
]}
);
</script>
<!-- END Criteo Conversion Tag -->
Example¶
<!-- Criteo Conversion Tag -->
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
window.criteo_q.push(
{ event: "setAccount", account: {{accountid}} }, // You should never update this line
{ event: "setEmail", email: "##Email Address of User##" },
{ event: "setEmail", email: "##SHA256-hashed Email Address of User##", hash_method: "sha256" },
{ event: "setEmail", email: "##MD5-hashed Email Address of User##", hash_method: "md5" },
{ event: "setSha256HashedPhoneNumber", phone_number: "##Hashed phone number##" },
{ event: "setPhoneNumber", phone_number: "##Plain text phone number##"},
{ event: "setSiteType", type: deviceType},
{ event: "trackTransaction", id: "ORD_7654322", item: [
{id: "lead_xyz", price: "0", quantity: 1 }
]}
);
</script>
<!-- END Criteo Conversion Tag -->
Configure sharing of 1st party data identifiers¶
There are two options to receive 1st party data identifiers in Criteo tags:
1. Passing of hashed emails (HEMs) to Criteo
[[email_hashing]]
2. Passing of Hashed Phone Number (HPN) to Criteo
[[phone_number_hashing]]
Verification¶
[[accurate]]