Shopify has multiple concepts of Locale - including language and currency.
This don't map exactly to Mention Me locales so it can be helpful to introduce some translation based on your requirements.
By default, we will assume a combination of the Shopify Locale and Shopify Country, or for the Order Confirmation page we will use the Billing Address Country.
You can customise this to your needs and the offers you will be presenting to customers in Mention Me.
Our default
By default, we will include a line in our instructions like this:
For most journeys:
// Locale ["locale", Shopify.locale + "_" + Shopify.country],
Or, for the referrer journey on post purchase:
// Locale ["locale", Shopify.locale + "_" + Shopify.checkout.billing_address.country_code],
You will need to replace these lines to map to the locale of your choice.
Your choices
In most cases, our choice will be a sensible default - but it may not always match the offers you want to present to customers nor might it match with the Offers you're giving customers inside Mention Me.
You can either:
Hardcode this variable (e.g. always show all customers an offer in English in £) with a snippet like:
// Locale
["locale", "en_GB"],
Or, you could write your own code to determine a preferred Locale for your users. The Locale must match a Mention Me Locale. These are a string with the ISO 639-1 language code, an underscore (_
), then the ISO 3166-1 alpha-2 country code (e.g. fr_FR for French/France).
We have provided some example code for a specific situation which you may want to adapt below.
An Example
The below is an example which will map:
- US customers to US English in US Dollars
- UK customers to British English in British Pounds
- Norwegian customers to English, with the Norwegian Krone
- French, Germany and Spanish customers to English, with Euros.
// Place this after the opening <script> tag
function getMentionMeLocale() {
var countryCode = Shopify.country;
if (Shopify.checkout && Shopify.checkout.billing_address) {
var countryCode = Shopify.checkout.billing_address.country_code;
}
switch (countryCode) {
case "US":
// US Customers get English, US Dollars
return "en_US";
case "GB":
// UK customers get English, Pounds
return "en_GB";
case "NO":
// Norwegian customers get English, with Krone
return "en_NO";
case "FR":
case "DE":
case "ES":
// French, German and Spanish customers get English Euros
return "en_EU";
default:
// For everyone else, assume we want to show English, Pounds
return "en_GB";
}
}
And then adjust the existing line of code to:
// Locale ["locale", getMentionMeLocale()],
Your locales
Your choices and preference will depend on the how you want to show your journey to customers.
Speak to our Onboarding Team if you'd like help coming up with the best mapping.