# Google Analytics is blocked by CSP policy

**URL:** https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098
**Category:** Support
**Created:** [March 2, 2020, 4:34pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098 "2020-03-02T16:34:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![petepan23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petepan23/32/161836_2.png) [@petepan23](https://meta.discourse.org/u/petepan23)
#### Post date: [March 2, 2020, 4:34pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/1 "2020-03-02T16:34:15Z")

</div>

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](http://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

 ![ga_block](https://global.discourse-cdn.com/meta/original/3X/9/b/9b6a6a08ed7da39f0dcdc3578dd15e4b4e2ae82a.png)

Am I missing something?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [March 2, 2020, 4:48pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/2 "2020-03-02T16:48:18Z")

</div>

It’s blocked for me too on all websites thanks to [Firefox’s content blocking](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Privacy/Tracking_Protection). Are you using Firefox? Or some plugin that blocks ads and tracking?

---

<div class="post-metadata">

### Author: ![petepan23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petepan23/32/161836_2.png) [@petepan23](https://meta.discourse.org/u/petepan23)
#### Post date: [March 2, 2020, 4:50pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/3 "2020-03-02T16:50:39Z")

</div>

It works for me now.

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

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [March 2, 2020, 6:49pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/4 "2020-03-02T18:49:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [March 2, 2020, 7:03pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/5 "2020-03-02T19:03:53Z")

</div>

[Google’s article](https://developers.google.com/tag-manager/web/csp) for tag manager suggests you might need to add `https://ssl.google-analytics.com` for Analytics.

---

<div class="post-metadata">

### Author: ![petepan23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petepan23/32/161836_2.png) [@petepan23](https://meta.discourse.org/u/petepan23)
#### Post date: [March 2, 2020, 7:55pm UTC](https://meta.discourse.org/t/google-analytics-is-blocked-by-csp-policy/143098/6 "2020-03-02T19:55:48Z")

</div>

> [@neil](#):
>
> [https://ssl.google-analytics.com](https://ssl.google-analytics.com)

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