Customer Events Pixel Access-Control-Allow-Origin Error

Shopify Partner
24 0 7

Can anyone explain to me why I cannot seem to use a custom, customer events pixel to post data to an externally hosted server?

I have a simple script intended to post data to an external server:


analytics.subscribe('product_viewed', (event) => {
  const product_data = {
    attribute_one: “xxxxxxx”,
    attribute_two: “xxxxxxx”,
  fetch(', {     method: 'POST',     headers: {       'Content-Type': 'application/json'     },     body: JSON.stringify(product_data),     keepalive: false,   }) …. });

But I consistently get errors like:


Access to fetch at '' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

If I make the same exact call outside of the customer events section, the request is successful and I receive no errors. No issues.

I'm using the same data, the same server & configurations, the same endpoint. The only difference is where the call takes place i.e. inside the customer events section vs directly on the product.liquid file.

This seems like a pretty obvious use case for the customer events utility. The external server, of course, is hosted on a different domain than the shopify store but is this intended behavior? What am I missing?


Thanks for any help!

Replies 5 (5)

Shopify Partner
2 0 2


9 0 1

I suspect our team is likely to run across this as we migrate our checkout.liquid pixels to extensibility. Also following. 

Shopify Partner
1 0 0

Hi. I also posted the same problem. Can only be called for 3rd party url. It doesn't work for url stores. Is there any way to resolve it?

9 0 1

@Bob-9x do you have a link to your post? Would like to subscribe.


9 0 1

Bumping this as we have indeed run into this issue.