How to setup trackPageview on the New Google Analytcis? -


we've used analytics trackpageview this:

var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-1']); _gaq.push(['_trackpageview', '/step1']);  (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })();  

however, in new analytics, script isn't formatted same way , i'm bit confused how/where should add in trackpageview code.

(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-1', 'page.com'); ga('send', 'pageview'); 

so in new code should put "_gaq.push(['_trackpageview', '/step1']);" , in format?

i'd start reading documentation available new analytics.js library since explains of this.

anyways, looks you're trying override default value page views , set own path. there no _gaq or _trackpageview new analytics.js library. instead, equivalent code be:

ga('create', 'ua-1'); ga('send', 'pageview', '/step1'); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -