Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Get a shops permanent url from inside an App Web Pixel

Get a shops permanent url from inside an App Web Pixel

SponsorlessTeam
Shopify Partner
2 0 0

Alright community, hopefully I'm just missing something here.  From inside my App Web Pixel, I am registering an event listener :

 

  analytics.subscribe('checkout_completed', (event) => {

 

 

Inside that subscribe function, I'm wanting to get the permanent url for the shop that the checkout came from but I can't find a way anywhere to get access to it from the Shopify API: https://shopify.dev/docs/api/web-pixels-api/standard-api 

Any ideas on how I can get it? As always, thanks for your generosity with your time and wisdom.

Replies 2 (2)

jains
Shopify Partner
12 0 8

I'd also like to know how to do this.

Anyone?

kevindevin
Shopify Partner
1 0 0

There is a `document.location` available in the `context` found here:
https://shopify.dev/docs/api/web-pixels-api/standard-api/init#properties-propertydetail-context

I am using `init.context.document.location.hostname` for finding the originating domain.