Sign in

Welcome to our Support Center

Get help with integration and live campaigns

Welcome to our Support Center. Get help with integration and live campaigns

Managing your different site types

The dynamic setSiteType parameter is present in the Criteo OneTag embedded on every page of your site. If your site has different versions to support a range of devices, indicate which version is displayed to the user via "setSiteType" parameter:

  • d for desktop
  • m for mobile
  • t for tablet

Examples:

setSiteType parameter on the desktop version of a site:

 { event: "setSiteType", type: "d" },

setSiteType parameter on the mobile version of a site: 

 { event: "setSiteType", type: "m" },

setSiteType parameter on the tablet version of a site:

{ event: "setSiteType", type: "t" },

If you are unable to dynamically send this value, you can use the following script to automatically detect if the user is on desktop, mobile, or tablet:

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

Then, you need to place the deviceType variable in the tag. So the "setSiteType" parameter would look like this:

 { event: "setSiteType", type: deviceType },

And the Homepage Tag would look like this, for example:

<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: YOUR UNIQUE ACCOUNT ID },
{ event: "setSiteType", type: deviceType },
{ event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },
{ event: "viewHome"}
);
</script>
Was this article helpful?
1 out of 1 found this helpful
Powered by Zendesk