In our series of articles on how to improve page speed, a constant theme is culling as many external resources as possible. Google fonts, CSS and Javascript. Every additional script or CSS file that loads slows things down. Yes, we can defer the loading, and make sure that the viewer can start interacting with the content earlier. But the fact remains that the “Page Load” metric takes into account ALL resources, and the clock keeps ticking until everything is loaded.
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:
stats.g.doubleclick.net
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:
allowAdFeatures
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:
This will improve your page speed times and strengthen your privacy policy as well!
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!
draadlozeoortjes.com says
Thanks! I Had these settings already, but still a request to doubleclick was made. not sure if I fixed it now, but I saw a new option in Google Analytics withing the Data Collection settings. It’s called “Advanced Settings to Allow for Ads Personalization”. Looks like this will exclude some countries from this setting.