Is it possible to use Google Analytics within my Shopify embedded public app?

madefresh
New Member
5 0 0

Hi. Is it possible to use Google analytics within my shopify embedded app?

I have tried so many solutions and nothing seems to work. E.g.

https://www.npmjs.com/package/react-ga 

https://github.com/Shopify/quilt/blob/main/packages/react-google-analytics/README.md

 

To me, it seems because the parent domain is different than my embedded app domain (public app is inside an iframe on shopify admin), it doesn't work, probably due to browser security issues.

 

If I go directly to my public app URL with the shopify origin parameter present, and fire an event on load, it does register in Google Analytics.

 

But, because of the way embedded apps work, they (after about 2 secs) forceably redirect back to https://[mystore].myshopify.com/admin/apps/[my-public-app]

 

No events or page views are registered from this point onwards.

 

No console errors are being logged. The functions to track are 100% being called as I added debugging logs inside them.

 

Thanks 

 

0 Likes