Search code examples
google-analyticsanalytics

What happens if you remove ga('send', 'pageview');?


By a mistake I managed to remove ga('send', 'pageview'); from one of my pages. And it has been like that for a while... Out of curiosity I wonder how important this line is, and what it actually does?

Obviously, a pageview will not be tracked for that page, but will other stuff be tracked? What about sessions, users, etc.? Will that be tracked if this line it omitted?

If you wonder how I could forget this line on one of my pages, it is because I copy & pasted it from the index.html of a dynamic webpage that uses angulartics, and this line is not supposed to be used then.

Help appreciated!


Solution

  • If you remove that line, nothing will be tracked.

    The only way to track things with analytics.js is to make ga('send', ...) calls. If you make no send calls, then absolutely nothing will be tracked.

    Unlike what many people seem to think, analytics.js doesn't send anything to Google Analytics unless you explicitly tell it to.