Table of contents
![](https://media.stonly.com/media/images/e04a9f42-10f1-4cdc-9dd9-b7bba62b8b4b.png?s=f7ad019d6d2d10b3ddc70e20804f9679a19e393de52401a8308b80b631fce51b6e8b14d0ef0ce5df4293dcbb90766d2add05ae5f637f604930fa2cf9ad5fbfdf234dbf1f119f8ed51e9170d11725403c85951772a845527562c8bd6b7130f9192d0cfeebd90926bbab6a1a435e242b19&w=1280&h=1440&auto=format)
Welcome! This document will explain integrating with Commerce Grid's Standalone / Publisher Tag solution.
Criteo provides a piece of code to be added in the header of the pages before the ad server callout. This generates an asynchronous call so Criteo can identify the user and return a bid. This information, including the bid price, is then sent to the ad server.
Criteo campaigns are targeted in the ad server based on Custom keyword criteria.
Requirements
You will receive from Criteo:
A script library to be placed on the header of your pages
A list of identifiers for each ad placement and/or format you have available on the page
Code samples demonstrating how to initialize the Criteo tag and how to map the placements
Creative codes to be used in the ad server
We will need you to:
Implement the scripts on the page header
Map the placements available on each page and use it to initialize our tags
Create the line items for the different bid prices in your ad server
Implement the targeting rules and the creative code
Criteo complies with the IAB Consent Framework. Please refer to their documentation for more information and examples of certified CMPs.
This code initializes the Criteo tags to make your inventory available to Commerce Grid's demand sources. The code will load the publishertag.js
library and build the events queue that will be used later. The loader request is asynchronous and is cached on the user's browser. No code changes are required in this section.
The next step is to map all the ad units available on the page and assign their code to their respective Criteo ID.
ad unit code | format | Criteo zone id |
---|---|---|
ad-unit-0 | 300x250 | 775590 |
ad-unit-1 | 728x90 | 775591 |
A global placement identifier (GPID) is a publisher-specified placement (tag) ID that is passed unchanged by all supply-side platforms (SSPs).
The mapping is now used to generate a bid request to Criteo's endpoint.
Criteo.events.push(function() {
: The code wrapped inside this function is added to theCriteo.events
queue that will be processed asynchronously as the page loads, allowing our bid to be inserted prior to ad server decisioningCriteo.SetLineItemRanges("[min1]..[max1]:[increment1];[min2]..[max2]:[increment2];");
: This defines the price band granularity which will be sent to the adserver. Must begin with 0. Three common examples below:Criteo.SetLineItemRanges("0..3:0.01;3..8:0.05;8..20:0.50;20..30:1.00");
- Single Order with 434 LICriteo.SetLineItemRanges("0..10:0.01;10..25:0.05;25..50:0.10;50..100:0.25");
- 1750 LI in 4 OrdersCriteo.SetLineItemRanges("0..50:0.01;50..100:0.20");
- 5250 LI in 12 Orders
Criteo.RequestBids([adunits], [callBack], [timeout]);
: This will send a browser request for the givenadunits
and will execute the callback functioncallBack
as soon as Criteo responds or thetimeout
is triggered
HTTP REQUEST
The code above will finally build a request to bidder.criteo.com
sending the adUnits in the HTTP POST
header
Parameter | Example | Description |
---|---|---|
Host | This is the page domain | |
Referer | This is the request referer | |
Form Data | {"publisher":{"url":"http://www.publisher.com/my/page"},"slots":[{"impid":"ad-unit-0","zoneid":775590},{"impid":"ad-unit-1","zoneid":775591}]} | Adunits mapping |
HTTP RESPONSE
In case Criteo has a bid for the user, the request above will return a HTTP STATUS 200
with an array of slots
object described below :
Field | Type | Description | Example |
---|---|---|---|
impid | String | The adunit id provided in the request |
|
cpm | Float | The raw bid CPM |
|
displayurl | String | The JS creative URL |
|
zoneid | Integer | The Criteo zoneid provided in the request |
|
width | Integer | The creative width |
|
height | Integer | The creative height |
|
native | Object |
| See assets section |
In case the user is not eligible for any Criteo campaign, the bid response will be an empty response.
The callback function is executed as soon as the bid response is received. The bids must now be processed and sent within the adserver request. The examples from now on will use DFP as a reference, but this can be adapted to any adserver that supports keyword targeting.
The adserver request must wait for the Criteo bidder to respond first. This can be achieved by using a combination of two functions:
disableInitialLoad()
: This will prevent the Adserver from being charged automatically as the page loadsgoogletag.pubads().refresh()
: This will be used to finally trigger the adserver call after the Criteo bid response or if the timeout is reached
More details on DFP's documentation here
This can be implemented in the callback function that will be triggered once the Criteo bid response is received (or after the timeout). On our previous example, we are using the function named launchAdServer
.
Criteo.RequestBids(adUnits, launchAdServer, 700);
triggers the bid requestlaunchAdServer
is executed within 700 ms or less depending on how fast Criteo respondsThe auxiliary function
Criteo.SetDFPKeyValueTargeting()
automatically parses the response and sets placement-level keywords to the adserver :
Keyword | Type | Description | Example |
---|---|---|---|
crt_bidid | String | An unique random identifier for the bid |
|
crt_pb | String | The bid price band CPM |
|
Complete example:
You will find a full example on this page
![](https://media.stonly.com/media/images/e04a9f42-10f1-4cdc-9dd9-b7bba62b8b4b.png?s=f7ad019d6d2d10b3ddc70e20804f9679a19e393de52401a8308b80b631fce51b6e8b14d0ef0ce5df4293dcbb90766d2add05ae5f637f604930fa2cf9ad5fbfdf234dbf1f119f8ed51e9170d11725403c85951772a845527562c8bd6b7130f9192d0cfeebd90926bbab6a1a435e242b19&w=1280&h=1440&auto=format)
To enrich the bid request data with user IDs (first-party user IDs, third-party IDs, or hashed emails), please use the function Criteo.SetIdentities
as described in the sections below.
This function accepts an array of OpenRTB EIDS objects as input:
Field | Type | Description |
---|---|---|
source | String | Identifier source URL (publisher URL or vendor URL). |
uids[].id | String | User identifier |
uids[].atype | Integer | Identifier type. |
uids[].ext.stype | String | ID Source type. |
uids[].ext.persistence | String | (Optional, Criteo-specific) |
Use the function Criteo.SetIdentities
providing the data below (examples on the right):
source: your domain
id: the user identifier
atype: Must be
1
for cookie/device-based ID, must be3
for person-based ID (eg: authenticated user ID, login ID, CRM/customer ID)ext.stype:
ppuid
ext.persistence:
js
orhttp
Use the function Criteo.SetIdentities
providing the data below (examples on the right):
source: the third party solution domain
id: the user identifier
(recommended) atype:
1
for cookie/device based ID,3
for person-based ID (eg: authenticated user ID, login ID, CRM/customer ID)(optional) ext.persistence:
js
orhttp
Use the function Criteo.SetIdentities
providing the data below (examples on the right):
(optional) source: your domain or the domain of the solution operating on your behalf
id: the user data
atype:
3
ext.stype: hashing algorithm used:
cleartextemail
,hemsha256
,hemmd5
,hemsha256md5
. Please refer to next section for details on hashing formats.
Hashing Formats
The hashing should be the users’ email address:
Encoded in UTF-8
Trimmed of any white space (eg: “test@criteo.com “ should become “test@criteo.com”)
Converted to lowercase
Hashed with MD5/SHA256/SHA256(MD5) & output as ASCII text
Example:
Type: String
Original Email: john.doe@gmail.com
SHA256: 375320dd9ae7ed408002f3768e16cb5f28c861062fd50dff9a3bff62e9dce4ef
MD5: e13743a7f1db7f4246badd6fd6ff54ff
SHA256 of MD5: 000e3171a5110c35c69d060112bd0ba55d9631c7c2ec93f1840e4570095b263a
Helpful links : https://www.miraclesalad.com/webtools/md5.php and https://www.miraclesalad.com/webtools/sha256.php