javascript - Is Google Rendering Bad Tracking Codes? -
i've gotten lot of response saying google tracking code excessive in many ways, , suspect perhaps not features working. (there's metrics aren't showing data: "paid traffic" , "campaigns" example)
is possible google rendering less useful tracking codes?
should return old format of tracking codes, since know work well?
could placement on page? google recommends before </head>
yet on here recommends before </body>
.
what google rendered me: (current)
<script> (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'); ga('create', 'ua-40498113-1', 'caseykidd.com'); ga('send', 'pageview'); </script>
my old tracking code: (circa 1 year ago)
<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-28036048-1']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); </script>
the "new" tracking code analytics.js
, "is part of universal analytics, in public beta".
granted can google analytics pages give beta code, stick tried , true ga.js
on production websites until google pulls out of beta.
the new tracking code has async enabled default, in recent browsers won't stall page load if there problem loading google analytics. why recommend put ga.js
tracking code before </body>
instead of </head>
.
Comments
Post a Comment