I’m working on implementing tracking for a multi-market Shopify store (thehappybed.com) that uses Shopify Markets for international sales across multiple European countries (NL, BE, FR, etc.).
Current situation:
Each market corresponds to a specific country
Different marketing pixels need to be fired based on the market/country
Currently using custom JavaScript to determine the market based on URL patterns and country data
This solution is proving unreliable and difficult to maintain
Question: Is there a way to access the current Shopify Market directly through the data layer?
Ideally, I’d like to:
Have the market identifier (e.g., ‘nl’, ‘be’, ‘fr’) available in the data layer
Use this for consistent market-specific pixel firing
Avoid relying on URL parsing or custom JavaScript solutions
@Jos_Meiling handling markets is a feature we’re discussing. Market data is not exposed in the pixel_api so it’s not as straightforward as we’d want it.
That being said, I don’t understand why you need custom JS for this. Native URL (or Page Path) variable + native Lookup Table is all you need to handle destinations dynamically.
Great, that you are discussing this. Hopefully, you find a proper solution to incorporate it.
Regarding the custom JS, on regular pages you can extract it from the url (f.e. https://thehappybed.com/da-dk). In this this case the market is ‘dk’. The fallback market is the netherlands (no /nl-nl included). Starting from the checkout the market is no longer in the url. From that point on I take the user country. Additionally, the same container is used on a different domain for UK:happtduvet.co.uk (uk market), which is using the same theme.
If you have any suggestions to make it more robust, please reach out