Problem when extending Shopify Pixel Extension features

Problem when extending Shopify Pixel Extension features

fabian-murillo
Shopify Partner
5 1 3

Hello guys, I'm running into issues trying to extend the Pixel Extension features. 

 

Basically I've created a custom Pixel Extension with the objective of extending the information that is sent to my Analytics events. I know inside the Pixel Extension we have access to the "analytics" object and its "event" object as well, but the information provided by the event object is not enough as I need to get also information such as customer's first and last purchase date, customer tags, checkout shipping method and payment methods selected, customer's total value in purchases, etc.

 

I was reading on the docs that we could use the GraphQL Admin API to extend this functionality but I couldn't make it work, and I didn't find any resource or forum talking about it.

 

So what I've decided to try next is calling Shopify API from my Pixels Extension expecting to get the mentioned extra data but it seems Pixels Extension doesn't provide a way to call Shopify API directly neither, so finally I've decided to use Proxy API in order to authenticate to my App and then be able to call Shopify API, but it's likely the Proxy API is also blocked for Pixel Extensions. What I'm getting every single time I use Proxy is a "CORS same origin error" rule. Check the image below.

image (2).png

 

Following the code and Proxy configuration I'm using:

image (3).png

 

Following the Pixel Extension code call:
image (4).png

Following my App's /api/getData endpoint code:
image (5).png

As a note I've already enabled the Pixels Extension App so it is already triggering the call when "all_events" event happening.

Also need to mention that I tested the same call to /apps/app-proxy/api/getData endpoint from different Extensions like Theme Extension and the response was successful, so it makes me thing it is a blocker happening only with Pixel Extensions.

 

This is a new feature we're building based on a resource tutorial as mentioned above the purpose is basically to extend the Pixels functionalities we get if only using Shopify Pixels default feature, it makes me think why should we bother in creating a custom Shopify Pixels Extension if basically the functionalities are the same as default ones and we can't extend more?. What is the purpose of creating a Pixel Extension?.

 

This issue is actually pretty easy to replicate, just need to configure the Proxy in your Partners dashboard app and fetch a request to any of your App's public endpoints.
 
Let me know if someone has issued the same or if you actually know any other way I could call Shopify Admin API from a Pixels Extension and being able to extend the data we can deliver to the Analytics apps.
 
Thanks
Replies 0 (0)