How to Pass Market Identifier (Market ID)
Overview
A market identifier (market ID) is used when you want to send you traffic to different pixels based on a Shopify Market. To do this, you'll select "Allow different pixels per Shopify Market" in you Shopify source, and configure your destinations accordingly. These configurations will handle passing the client and server-side data from the checkout portion of your Shopify store. For the headless portion of you store you'll need to handle loading the correct GTM container per market and pass the market ID into the function below so that it can be used for any server-side events that originate in the browser before the checkout.
How to Find Your Market ID for Your Shopify Market
Within you Shopify store navigate to Settings and select Markets from the left navigation. Then select each individual market. The numeric value at the end of the URL for each market is the Market ID.
How to Pass Your Market Identifier (Market ID)
You can provide your own user id by doing the following. Note that this code MUST be run before the Elevar snippet you've copied from the Elevar app is run.
const getMarketId = async () => Promise.resolve("8699379939");
window.ElevarMarketIdFn = async () => {
const marketId = await getMarketId();
return marketId
}
The ElevarMarketIdFn must return a string or a promise that returns a string
Examine the console for errors from Elevar after your function is defined
The market id function must be defined on every page reload, this doesn't include virtual page changes
Notes:
- If you've run the Elevar scripts/snippet prior to defining your market id function, Elevar won't recognize the market id.
Updated 3 months ago