1
votes

I have a need to include the Google Analytics analytics.js ga() script on a site but I want to disable the automatic pageview collection. I still want to be able to use the dynamic/virtual pageview tracking (i.e. ga('send', 'pageview', url); ) but only those requests.

How can I accomplish this? I've found ways to do it with gtag() but I do not utilize gtag and that is not an appropriate solution for my issue.

1

1 Answers

1
votes

To remove the automatic pageviews that the ga script automatically does, just delete this command:

ga('send', 'pageview', url);

Then, in Universal Analytics, you can send a virtual pageview by running this code at the moment you want:

ga('send', { 'hitType' : 'pageview', 'page' : 'name of virtual pageview' })