Prevent Google Analytics from making requests to

TIL why Google Analytics makes requests to and how to prevent Google Analytics from making these requests.

A couple days ago I implemented a Content Security Policy (CSP)—I will soon blog about the actual implementation. I tested the CSP and in dev mode everything worked. Yesterday I deployed the CSP on my website and to my surprise I got several reports of an attempt to violate my CSP:

"csp-report": {
    "document-uri": "",
    "effective-directive": "img-src",
    "original-policy": "default-src 'none'; frame-ancestors 'none'; base-uri 'self'; font-src 'self'; frame-src; img-src 'self' data:; script-src 'self'; style-src 'self'; report-uri",
    "blocked-uri": ""

In Chrome I opened and Dev Tools, then I saw a message that Chrome refused to load the following image: (...)

because it violates the directive img-src from my CSP.

If I go to URL of the image myself, I get a HTTP 302 and get redirected to: (...)

Note that I see my Google Analytics (GA) tracking ID in the query string parameters &tid=UA-104058193-1.

Hmm. It looks like GA makes a request to

What is the relation between DoubleClick and GA?

Google says that GA reads the DoubleClick cookie to get information about Display Features—which can be used to enable Advertising Features in GA.

What is the difference between DoubleClick and GA?

According to Google:

  • DoubleClick: Ad management and reporting ad metrics such as clicks and impressions.
  • GA: Insights on website traffic and where the traffic came from.

Why is a request made to

Apparently, for users that have enabled remarketing with GA, a third-party DoubleClick cookie is used to enable remarketing—for products like AdWords on the Google Display Network. If you enable this feature, information—including the third-party DoubleClick cookie—is sent to the Analytics servers.

I can not remember that I enabled this feature and I do not see anything in my JavaScript files that suggests a request to DoubleClick. This request is not needed for GA to work properly and it only makes the response time longer. Even though the request is blocked by my CSP, the best thing to do is to prevent GA to make the request.

How to prevent GA making requests to DoubleClick?

The answer is pretty simple. Go to GA -> Admin -> Tracking info -> Data Collection -> disable both toggles and click on save. It can take up to 24 hours for the changes to take effect.

Google Analytics made a request to and violated my CSP