I'm using Google Analytics to send and track a registration goal, based on a custom pageview.

Basically, every time a user registers and gets redirected to dashboard, I trigger a custom pageview using JS:

ga('send', 'pageview', {page: '/gapv/registration/success'});

The tracking works. However, when I compare the GA tracking with the number of registrations from the database of my website, the GA goal completion always shows around 10% less registrations.

I checked the tracking on various desktop browsers, all seems to be fine. Additionally, I hear that content blocking on mobile browsers gets more and more popular.

Is it possible that browser content blocker plugins might block my custom pageview from being fired? I send the pageview on DOM ready.

What else might explain the difference between my DB results and the GA goal count?

Any ideas are very welcome.

1 Answer 1


I send the pageview on DOM ready.

Assuming you mean on the DOMContentLoaded event, there's a problem all in itself. The tracking script is asynchronous and deferred, meaning that it purposely defers its loading (as to not block the rest of the webpage from loading) and isn't guaranteed to be fully complete when the DOMContentLoaded event fires. Try listening for the load event on window instead and send the hit then.

  • Thanks! I'm using jQuery, so do I understand it correctly, that you suggest that firing the pageview on $(window).load(), rather than on $(document).ready() - would make a difference? I mean, if the GA script is asynchronous anyway, does it matter where it is defined?
    – lesssugar
    Jan 25, 2016 at 12:13
  • Also, would switching to server-side Analytics (PHP) solve the problem?
    – lesssugar
    Jan 25, 2016 at 12:20
  • 1
    To answer your first question - Yes, it makes a huge difference. DOMContentLoaded is fired when the DOM has been constructed but provides no guarantee that its resources (i.e. images, scripts, etc.) have been fully loaded and parsed. The tracking script itself should be completely loaded on DOMContentLoaded but it makes a call to //google-analytics.com/analytics.js, which is a file that's dynamically inserted into the DOM and provides the base components for the tracking script. Point being, there's a good chance the external file won't be finished loading when you send that initial hit.
    – nburr
    Jan 25, 2016 at 13:25
  • And to answer your second question - I'm sure it's a possibility but with a few slight adjustments, the standard way should work just fine.
    – nburr
    Jan 25, 2016 at 13:27

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.