Skip to content

Instantly share code, notes, and snippets.

@timelf123
Last active December 21, 2015 23:28
Show Gist options
  • Save timelf123/6382298 to your computer and use it in GitHub Desktop.
Save timelf123/6382298 to your computer and use it in GitHub Desktop.
ama LTL UA pixel ratio
// Create the test
var dpr = 1; // if no pixel ratio available. Assume 1:1.
if(window.devicePixelRatio !== undefined) dpr = window.devicePixelRatio;
// Pass it along through GA
ga('create', 'UA-37974233-3', 'amacoverage.com');
// --- IMPORTANT LINE!
// dimension1 - was set in UA interface before development of this code. Any new dimensions need to be added to the interface first
ga('set', 'dimension1', dpr);
ga('send', 'pageview');
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment