Personalized checkout and custom promotions with Shopify Scripts
We have been trying to setup a function such as below on a Sandbox pixel page that tracks Checkout and thank you. There is no one publicly available link that states that clearly and I just wanted to know for a Checkout and thank you Sandbox will this work?
function(){
var meta = window.ShopifyAnalytics && ShopifyAnalytics.meta;
if (meta && meta.page && meta.page.pageType) {
return meta.page.pageType;
}
var path = window.location.pathname || '';
if (path.indexOf('/checkouts/') === 0) {
return path.indexOf('/thank-you') > -1 ? 'thank_you' : 'checkout';
}
return 'storefront';
}
There is no single publicly available link that explicitly states:
“Inside Shopify’s sandbox iframe for web pixels, the global window.ShopifyAnalytics and its property ShopifyAnalytics.meta are available.”
If you are referring to sandbox in Pixels API, the window element is not available in sandbox environment so you cannot use this code,
So What would be a better way to Track Sandboxes Page type in Shopify
I did run a sample JS and gave me this
So this wont happen inside a Sandbox Thank you or checkout page ?
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025