Google Analytics is blocked by CSP policy

Hi,

I try to set up Google Analytics but no luck.
Here is what I did:

  • ga universal tracking code: My analytics ID
  • ga universal domain name: mysite.com (without www)
  • content security policy script src: I added “https://www.google-analytics.com/

But I still don’t receive any hits. When I check with GTmetric then the google analytics js is blocked

Am I missing something?

1 个赞

It’s blocked for me too on all websites thanks to Firefox’s content blocking. Are you using Firefox? Or some plugin that blocks ads and tracking?

3 个赞

It works for me now.

My solusion is UNCHECK the content security policy. This one is enable by default. Maybe some expert advice here?

The first piece of advice would be don’t disable CSP.

The security of your site is vastly more important than cutting corners implementing analytics correctly.

8 个赞

Google’s article for tag manager suggests you might need to add https://ssl.google-analytics.com for Analytics.

5 个赞

If I enable CSP and add this one, then still doesn’t work.