Sometimes, extra stuff can download onto your page without you being fully aware of it. For example, most people have Google Analytics installed on their webpage – it’s a staple of tracking, is free, and has more raw functionality than any other tool. Some of us add it directly to our sites, while others use the Google Tag Manager.
Extra “DoubleClick” Scripts Loaded onto the Site
If you run your website through a tool like webpagetest.org, you will often see something like this in the report showing the number of domains that your page requests:
Along with the expected resource from google-analytics.com, we also see the following:
This is an additional script that collects specific demographic information about your visitors. You’ve probably enabled it without thinking in Google Analytics because it seemed like a good idea. But you might want to disable it for the following reasons:
Why Disable DoubleClick in Google Analytics?
The first reason of course, is speed. Every additional domain requires a DNS lookup, connection time, negotiation of SSL etc, and downloading the content. Then the JS needs to run, causing further delays. Every little bit matters!
The second reason is one of privacy. These days, every site is required to have data collection policies in the form of an explicit “Privacy” section. In that, you can provide some differentiation to your site by letting users know that you don’t collect any additional demographic information in addition to the regular Google Analytics code.
The second reason might not matter so much to you, but the first is at least a concrete one!
Method 1: Disabling DoubleClick from Within Google Analytics
The first method to disable DoubleClick is from inside the Google Analytics page itself. Navigate to your reports and click the “Admin” section at the bottom of the page.
This will present you with three columns, the middle one being called “Property”. Here, click the link called “Tracking Info” and in the drop-down list, click “Data Collection”.
This opens up a pane on the right-hand side. Turn the button to “Off”, and you’re done. You can see the position of the button from within the Analytics interface here:
The other is from Google Tag Manager:
Method 2: Disabling DoubleClick from Google Tag Manager
If you’re using the “Universal Analytics” built-in code from Google tag manager, then you can disable DoubleClick in a much more nuanced manner. You can do so only on specific pages, or you can set other custom rules like when it should be enabled etc.
To do this, go to your Google Analytics tag inside the Tag Manager and click on the “Edit” button. Enable the checkbox labeled “Enable overriding settings in this tag”. Now click the “More Settings” drop-down list and in the “Fields to Set”, use the following as the field name:
And in the value box, set it to “false”.
This can be easily explained with an image like this:
Save your tag, publish your changes, and you’re done.
Result: No More DoubleClick Code
After making one of the above two changes, you can run your page test again. This time you will see that the “stats.g.doubleclick.net” domain is missing as shown here:
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!