My old ga.js code is:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-1']);
_gaq.push(['_setDomainName', 'example.com']);

  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);

after I upgrade to new analytics.js code like this:

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-XXXXXX-1', 'auto');
ga('send', 'pageview');

I notice that my pageview is decreasing about 30% ~ 50%, and bounce rate is increasing about 130%

the obvious difference syntax between old and new is:

_gaq.push(['_setDomainName', 'example.com']);

As far as I know, actually there is no sub domain site, I guess maybe the old analytics data is incorrect, and the new analytics data is correct.

Is there anyone can explain why the analytics data change so big or what am I doing wrong?

1 Answer 1


Make sure if you are upgrading from the ga.js to analytics.js that you add your domain to the Property's Referral Exclusion List. It is done by default for new properties but needs to be done manually for GA Properties that existed prior to the Google changeover to analytics.js

With analytics.js a change in source during a session will end the current user session and start a new one. Self referrals may be a reason for some of the issues you are seeing.

If there were any virtual pageviews tracked with ga.js then they will need to be ported over to the analytics.js syntax to continue tracking.

eta, there is also an upgrade guide available in the dev docs, in the event you need to also upgrade event tracking, custom variables and so forth https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs

  • 1
    I'd check if any virtual pageviews have not been ported over. This would account for a drop in the pageview numbers. Only other things i can think of..ensure the code isnt missing on any pages Make sure no pages have a copy of each version of tracking (it will prevent it from tracking on the applicable page) Is it possible any of the pages were previously tagged incorrectly with double tracking code on them - lowering bounce rate and inflating the pageview count?
    – Bronwyn V
    Commented Oct 6, 2017 at 12:13
  • hi Bronwyn V, after I googled, some said check the network in the Chrome debug tool, if I see multiple "__utm.gif?....." requests, it means the page has incorrect multiple trackPageview, so I try this with my "old" ga syntax, it really shows "__utm.gif?....." twice as the screenshot image below, ibb.co/dkDF3w does this mean that my old ga data is "incorrect", and my new ga data is "correct"?
    – kRed
    Commented Oct 11, 2017 at 1:28
  • No, that is expected behaviour. It's initiated once by ga.js and once by _utm.gif. If you were seeing that x 2 on page load, then that would have been an issue.
    – Bronwyn V
    Commented Oct 15, 2017 at 5:58
  • thank you Bronwyn V, though I still can't find the real reason. :p
    – kRed
    Commented Oct 17, 2017 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.