Google Analytics 4 Events Blocked on Checkout Pages due to Content Security Policy (CSP) Headers

Google Analytics 4 Events Blocked on Checkout Pages due to Content Security Policy (CSP) Headers

Barnett4321
Shopify Partner
29 0 15

Google Analytics 4 events (begin_checkout & add_payment_info) are being blocked on Shopify's checkout pages due to poorly configured Content Security Policy (CSP) Headers.

 

Here's Google's documentation on which CSP Headers need to be set for GA4 to work:
https://developers.google.com/tag-platform/tag-manager/web/csp#google_analytics_4_google_analytics

Shopify has not implemented 

https://*.analytics.google.com

 And probably others and this is causing GA4 code to be blocked by browsers.

How to test? Check your GA4 events for begin_checkout and add_payment_info events and you'll probably have few if any.

Replies 2 (2)

johnnymonday
Tourist
3 0 1

So this is happening to me. What do I do about it?

 

marvic
Explorer
73 4 21

Where does this have to be implemented? I can't see any CSP headers in our shopify theme. Adding one manually breaks our site.