HELP: GTM/GA4 tracking from onsite 'Buy Button' through 'Purchase' with attribution preservation fail

Thanks for taking a read. Have a fail trying to retain attribution from onsite store through shopify checkout. Here are the specifics:

Setup & User Flow:

  • Shopify ‘Buy Button’ is installed on store domain. (Ex my_store.com)
  • When a user clicks the ‘Buy Button’
    • the Shopify sidebar menu opens, showing the item added to the cart
    • an ‘add_to_cart’ event is fired
  • When the user clicks ‘checkout’ in the sidebar menu
    • the Shopify checkout window opens (ex: my_store.myshopify.com)
    • a ‘checkout_started’ event is fired
  • As the user completes the purchase, additional events fire:
    • add_shipping_info
    • add_payment_info
    • purchase

Event Sources & Handlers:

  • On my_store.com
    • handled by GTM, including injected cHTML script for ‘Buy Button’
  • On my_store.myshopify.com
    • handled by GTM (same container as above) and Shopify Custom Pixel

Other Considerations:

  • cross domain tracking is setup in GTM and GA4.

Issue: When the user transitions from my my_store.com to my_store.myshopify.com, the following occurs:

  • cross domain tracking does not retain the session id (SID) and client ID (CID)
  • A new session is started
  • eCommerce/session attribution is lost
  • the resulting events show a source / medium of direct / none (or ‘not set’)

Questions:

  • Is there a way to retain session data across the jump from my_store.com to my_store.shopify.com?
  • Can dynamic UTM parameters be added to the my_store.shopify.com url when leaving my_store.com via the ‘checkout’ button? If so, how?

thanks!

Yes there is a way to keep session data but it’s manual - and you’d have to then move from the google-app to customer web-pixel events…
(if you truly are dropping sessions)

example of session storage before checkout that is then accessible in checkout:

dev docs: browser events

1 Like