Criteo OneTag (Lead Generation)

A guide to implement Criteo OneTag solution directly in your source code.

Overview

This tutorial will explain how to implement the Criteo OneTag solution directly in your source code. The Criteo OneTag should be placed in the header or body of each page on your site. Please implement the following 3 tags on your website:

  1. Homepage Tag

  2. Sign-up / Form Tag

  3. Conversion Tag

[[disclaimer-developer]]

Email Hashing

[[email_hashing]]

Tags

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
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

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" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "setSiteType", type: deviceType},
 { event: "viewHome"});
</script> 
<!-- END Criteo Home Page Tag -->

Example

<!-- Criteo Homepage Tag -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "79054025255fb1a26e4bc422aef54eb4" , hash_method: "md5" },
 { event: "viewHome"});
</script> 
<!-- END Criteo Home Page Tag -->

Sign-up / Form Tag

Install the following tag on each page of the sign-up form of your website. Example URL: {{homepageurl}}/sign-up/step1. If there is more than 1 page or step for the sign-up, you may add the user_segment parameter to each tag, corresponding to the step in the form.

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
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
CPA cost-per-lead/acquisition/price {{cpa}} String or Integer, excluding the currency symbol Optional
user_segment number of page or step in form. This is an optional field. 2 String or Integer Optional

Structure

Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events.

<!-- Criteo Sign-up / Form Tag -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "setSiteType", type: deviceType},
 { event: "viewItem", user_segment : ##Step Number##, item: [
    {id: "1", price: ##CPA##, quantity: 1 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Sign-up / Form Tag -->

Example

<!-- Criteo Sign-up / Form Tag -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "79054025255fb1a26e4bc422aef54eb4" , hash_method: "md5" }, 
 { event: "setSiteType", type: deviceType},
 { event: "viewItem", user_segment : 2, item: [
    {id: "1", price: {{cpa}}, quantity: 1 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Sign-up / Form Tag -->

Conversion Tag

Install the following tag on the sales confirmation or Thank You page of your website. Example URL: {{homepageurl}}/thankyou

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
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
CPA cost-per-lead/acquisition/price {{cpa}} String or Integer, excluding the currency symbol Optional
Transaction ID Confirmation or Order # 7654322 Integer. Unique ID Required

Structure

Dynamically replace fields surrounded by ## with users information.
You need to send at least one of the setEmail events.

<!-- Criteo Conversion Tag -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "setSiteType", type: deviceType},
 { event: "trackTransaction", id: ##Transaction ID##, item: [
    {id: "1", price: ##CPA##, quantity: 1 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Conversion Tag -->

Example

<!-- Criteo Conversion Tag -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js" async="true"></script>
<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: "79054025255fb1a26e4bc422aef54eb4", hash_method: "md5" },
 { event: "setSiteType", type: deviceType},
 { event: "trackTransaction", id: 7654322, item: [
    {id: "1", price: {{cpa}}, quantity: 1 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Conversion Tag -->

Verification

[[accurate]]