How to track traffic by device type

There is demand to build different AudienceReport reports depending on device type used. General way of doing that would be track this using 3 different TCodes like:

  • TSTforDesktop
  • TSTforTablet
  • TSTforMobile

TCode for tracking code should be chosen dynamically depending on visitors device type.

In order to automate device detection we are providing script called audiencreport.js that allows to track ad in different campaigns depending on device type.

How can I implement it?

There are a lot of ways based on advertisement campaign ids capabilities. Some of them(Script tag):

     1. You could pass campaign ids directly into script definition if you able to add regular SCRIPT. Format is:

<script src="http://cdn.userreport.com/audiencereport.js" id="ar-tags" data-ar-d= "{desktop-tcode}" data-ar-m="{mobile-tcode}" data-ar-t="{tablet-tcode}"></script>

     2. Alternative solution, where you pass all script parameters into separate HTML tag, for instance: span. Format is:

<span id="ar-tags" data-ar-d="{desktop-tcode}" data-ar-m="{mobile-tcode}" data-ar-t="{tablet-tcode}"></span>
<script src="http://cdn.userreport.com/audiencereport.js"></script>

Or(Script tag + campaigns definition in JavaScript code):

      1. Campaigns could be configured by JavaScript code if adding parameters to script URL is inconvenient by any reason. Synchronous type example:

<script>
window._AUDIENCEREPORT_CAMPAIGNS = {
desktop: '{desktop-tcode}',
mobile: '{mobile-tcode}',
tablet: '{tablet-tcode}'
};
</script>
<script src="http://cdn.userreport.com/audiencereport.js"></script>

     2. Asynchronous type example:

window._AUDIENCEREPORT_CAMPAIGNS = {
desktop: '{desktop-tcode}',
mobile: '{mobile-tcode}',
tablet: '{tablet-tcode}'
};
(function() {
var ur = document.createElement('script'); ur.type = 'text/javascript'; ur.async = true;
ur.src = ('https:' == document.location.protocol ? 'https://cdn.userreport.com/audiencereport.js' : 'http://cdn.userreport.com/audiencereport.js');
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ur, s);
})();



How did we do?

How often will I be asked to log in through the two-step verification process?

If you accidentally delete pixels from your project

Contact