Criteo OneTag

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 5 tags on your website:

  1. Homepage Tag

  2. Category / Listing Tag

  3. Product Tag

  4. Basket / Cart Tag

  5. Sales Tag

[[disclaimer-developer]]

Feed

Please provide your Criteo contact with a Google Shopping Feed if you already have one. If you do not have one already, plese build a product feed matching the Criteo Feed Specification.

Tags

Homepage Tag

Install the following tag on the homepage of your website. Example URL: {{homepageurl}}

Field Overview Example Syntax
email Plain-text or MD5 Hash 79054025255fb1a26e4bc422aef54eb4 String. Trimmed and lowercase 32 character, encoded in UTF-8

Structure

Dynamically replace fields surrounded by ## with users information. See Example

<!-- Criteo Homepage Tag -->
<script type="text/javascript" src="//static.criteo.net/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##" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewHome"});
</script> 
<!-- END Criteo Home Page Tag -->

Example

<!-- Criteo Homepage Tag -->
<script type="text/javascript" src="//static.criteo.net/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" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewHome"});
</script> 
<!-- END Criteo Home Page Tag -->

Category / Listing Tag

Install the following tag on the listing, category, and search results pages of your website. Example URL: {{homepageurl}}/category?id=categoryid1

Field Overview Example Syntax
email Plain-text or MD5 Hash 79054025255fb1a26e4bc422aef54eb4 String. Trimmed and lowercase 32 character, encoded in UTF-8
Product ID unique ID of Product ProductID_1 String

Structure

Dynamically replace fields surrounded by ## with users information. See Example

<!-- Criteo Category / Listing Tag -->
<script type="text/javascript" src="//static.criteo.net/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##" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewList", item: ["##Product ID 1##", "##Product ID 2##", "##Product ID 3##"] });
</script> 
<!-- END Criteo Category / Listing Tag -->

Example

<!-- Criteo Category / Listing Tag -->
<script type="text/javascript" src="//static.criteo.net/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" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewList", item: ["ProductID_1", "ProductID_2", "ProductID_3"] });
</script> 
<!-- END Criteo Category / Listing Tag -->

Product Tag

Install the following tag on the product detail pages of your website. Example URL: {{homepageurl}}/product?id=productid_1

Field Overview Example Syntax
email Plain-text or MD5 Hash 79054025255fb1a26e4bc422aef54eb4 String. Trimmed and lowercase 32 character, encoded in UTF-8
Product ID unique ID of Product ProductID_1 String

Structure

Dynamically replace fields surrounded by ## with users information. See Example

<!-- Criteo Product Tag -->
<script type="text/javascript" src="//static.criteo.net/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##" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewItem", item: "##Product ID 1##" });
</script> 
<!-- END Criteo Product Tag -->

Example

<!-- Criteo Product Tag -->
<script type="text/javascript" src="//static.criteo.net/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" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewItem", item: "ProductID_1" });
</script> 
<!-- END Criteo Product Tag -->

Basket/Cart Tag

Install the following tag on the cart or basket page of your website. Example URL: {{homepageurl}}/cart

Field Overview Example Syntax
email Plain-text or MD5 Hash 79054025255fb1a26e4bc422aef54eb4 String. Trimmed and lowercase 32 character, encoded in UTF-8
Product ID unique ID of Product ProductID_1 String
price unit price of product 200.99 String or Integer, excluding the currency symbol
quantity number of units added 2 Integer

Structure

Dynamically replace fields surrounded by ## with users information. See Example

<!-- Criteo Basket/Cart Tag -->
<script type="text/javascript" src="//static.criteo.net/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##" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewBasket", item: [
    {id: "##Product ID 1##", price: ##Product Unit Price##, quantity: ##Number of Units## }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Basket/Cart Tag -->

Example

<!-- Criteo Basket/Cart Tag -->
<script type="text/javascript" src="//static.criteo.net/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" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "viewBasket", item: [
    {id: "ProductID_1", price: 200.99, quantity: 2 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Basket/Cart Tag -->

Sales Tag

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

Field Overview Example Syntax
email Plain-text or MD5 Hash 79054025255fb1a26e4bc422aef54eb4 String. Trimmed and lowercase 32 character, encoded in UTF-8
Product ID unique ID of Product ProductID_1 String
price unit price of product 200.99 String or Integer, excluding the currency symbol
quantity number of units added 2 Integer
Transaction ID Confirmation or Order # 7654322 Integer. Unique ID

Structure

Dynamically replace fields surrounded by ## with users information. See Example

<!-- Criteo Sales Tag -->
<script type="text/javascript" src="//static.criteo.net/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##" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "trackTransaction", id: ##Transaction ID##, item: [
    {id: "##Product ID 1##", price: ##Product Unit Price##, quantity: ##Number of Units## }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Sales Tag -->

Example

<!-- Criteo Sales Tag -->
<script type="text/javascript" src="//static.criteo.net/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" }, // Can be an empty string 
 { event: "setSiteType", type: deviceType},
 { event: "trackTransaction", id: 7654322, item: [
    {id: "ProductID_1", price: 200.99, quantity: 2 }
    //add a line for each additional line in the basket
]}
);
</script> 
<!-- END Criteo Sales Tag -->

OneTag 2.0

[[cname]]

Verification

[[accurate]]