javascript - What is the analytics.js equivalent of _trackPageview found in ga.js -
using previous version of google analytics (ga.js) can track virtual page view using _trackpageview method record when downloaded or other metric if desired. using new analytics.js syntax track virtual page view?
just use standard _trackpageview method ga.js, in analytics.js can track virtual pageview using standard function.
assume have arleady initialised analytics tracking code below:
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-xxxxxxxx-x', 'name seen in ga tracking code');
now inside function block in page, want track virtual page view , call send pageview suitable name , title want virtual page:
ga('send', 'pageview', { 'page': '/usersignup', 'title': 'user signup' });
Comments
Post a Comment