Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Last Session Attribution via Webhooks

Solved

Last Session Attribution via Webhooks

curt60
Shopify Partner
2 0 0

I'm using webhooks to capture orders and need session referral attribution information.  I'm able to access UTM parameters using the Admin GraphQL; however, I need access to additional landing page query string parameters and/or cookie values.  Is there any way to access these latter two items via webhooks.

Accepted Solution (1)

Liam
Community Manager
3108 344 899

This is an accepted solution.

Hi Curt60 - from looking into this it doesn't seem that you'd be able to access these custom parameters or cookie values via webhooks.

 

However you should be able to use JavaScript to access the current page's URL using window.location.href and capture the query string paramters that way, while the document.cookie property lets you access cookies. Once you've captured the data you're interested in, you can send it to your server via an AJAX request.  

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)

Liam
Community Manager
3108 344 899

This is an accepted solution.

Hi Curt60 - from looking into this it doesn't seem that you'd be able to access these custom parameters or cookie values via webhooks.

 

However you should be able to use JavaScript to access the current page's URL using window.location.href and capture the query string paramters that way, while the document.cookie property lets you access cookies. Once you've captured the data you're interested in, you can send it to your server via an AJAX request.  

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

curt60
Shopify Partner
2 0 0

Thanks.  Yep, makes sense.

Along similar lines, it looks like some apps write the incoming parameters to the 'additional details' section of the order since that is retrievable via webhook.