How does Global-e integrate with websites?
Using Global-e as your checkout provider means your brand hosts specific pages within your website, such as the checkout or order confirmation page.
These pages contain only a Global-e iframe which populates the page with content. You can’t change this Global-e iframe or use variables not supported by their platform. However, you can "hook" into the functionality Global-e provides using their API to add the Mention Me integration.
There are two tags to implement: the Referrer tag and the Referee tag. Read on to get started.
Implementing the referrer tag
This tag lets you collect customer information and serve referral offers post-purchase.
Step 1: Add the tag
Copy and paste the script below on the web-page where your Global-e iframe is running:
<script type="text/javascript">
// First, we initiate Globale.
var glegem = glegem || function(){(window["glegem"].q = window["glegem"].q || []).push(arguments)};
// Next, tell Global-e that when a checkout step loads to call the Mention Me handler
glegem("OnCheckoutStepLoaded", checkoutHandlerMentionMe);
var checkoutHandlerMentionMe = function (data) {
// Ignore any steps except the confirmation
if (data.StepId === "undefined" || data.StepId !== data.Steps.CONFIRMATION) {
return;
}
// Ignore failed payments and page reloads
if (data.IsSuccess !== true || data.IsPageReload === true) {
return;
}
/* Dynamically build and inject the Mention Me tag */
var script = document.createElement("script");
var url = "https://tag.mention-me.com/api/v2/referreroffer/<PARTNER-CODE>?locale=<Locale>&situation=postpurchaseglobale";
url += "&email=" + encodeURIComponent(data.details.customerEmail);
url += "&fullname=" + encodeURIComponent(data.details.customerName);
url += "&order_number=" + encodeURIComponent(data.details.OrderReference);
url += "&order_total=" + encodeURIComponent(data.details.totalPriceExclVAT); //Total price excluding VAT and Shipping in customer currency
url += "&order_currency=" + encodeURIComponent(data.details.customerCurrency);
/* END Dynamically build Mention Me tag */
// Inject the Mention Me tag
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
};
</script>
Step 2 - Insert Mention Me PartnerCode and locale
You will need to make the following additional changes:
- Replace the
PartnerCode
parameter in the script with your Merchant PartnerCode (your Client Manager can supply this), - Set a Locale, replacing the
Locale
parameter in the script. You can either:- Hardcode the value, e.g. setting it explicitly to
en_GB
for all users; - Or dynamically set it with the GlobalE data layer, depending on your website setup.
- See this help article to learn more about locales.
- Hardcode the value, e.g. setting it explicitly to
Step 3 - Update your demo tags to the live URL
- When testing, use the URL
tag-demo.mention-me.com
in your tags to view the demo content. - Once you’re happy with the initial tests, switch to the live URL, using
tag.mention-me.com
instead.
Note: The live URL is disabled by default, so the content won’t display until you activate your account. This means we can test the live integration on your website before making the referral programme available to your customers. Your Client Manager can give you access to the debug tool to check the live integration and help with testing.
Additional help
You can find the mandatory Mention Me variables in these integration instructions and a full list of the Global-e data variables here. If you require additional help, please get in touch.
Implementing the referrer tag with Global-e and Shopify
If you’ve configured your Shopify store with Global-e, there will be a globale-tracking.liquid
snippet in the theme where some tracking scripts already exist using the OnCheckoutStepLoaded
callback.
Add the below script and make sure it only runs when data.StepId == data.Steps.CONFIRMATION
and data.IsSuccess && !data.IsPageReload
:
/* Dynamically build and inject the Mention Me tag */
var script = document.createElement("script");
var url = "https://tag.mention-me.com/api/v2/referreroffer/<Partner Code>?locale=<Locale>&situation=postpurchaseglobale";
url += "&email=" + encodeURIComponent(data.details.customerEmail);
url += "&fullname=" + encodeURIComponent(data.details.customerName);
url += "&order_number=" + encodeURIComponent(data.details.OrderReference);
url += "&order_total=" + encodeURIComponent(data.details.totalPriceExclVAT); //Total price excluding VAT and Shipping in customer currency
url += "&order_currency=" + encodeURIComponent(data.details.customerCurrency);
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
/* END Dynamically build and inject the Mention Me tag */
You will need to make the following additional changes:
- Replace the
PartnerCode
parameter in the script with your Merchant PartnerCode (your Client Manager can supply this), - Set a Locale, replacing the
Locale
parameter in the script. You can either:- Hardcode the value, e.g. setting it explicitly to
en_GB
for all users; - Or dynamically set it with the GlobalE data layer, depending on your website setup.
- See this help article to learn more about locales.
- Hardcode the value, e.g. setting it explicitly to
Here’s an example of this on a Shopify Shop which contains other tracking scripts. Note the Mention Me tag (second box) is added within the condition (first box).
Make sure that the following is placed in the theme.liquid also, to enable the globale-tracking.liquid to run at the postpurchase
situation.
{% include "globale-tracking.liquid" %}
This should be added into the headers right before </head> in liquid file. Example:
Implementing the referee tag
Implement the referee tag (Been referred by a friend? link) outside of the Global-e checkout (e.g. in your cart/shopping bag page or side-cart) so customers can tell us who referred them via name-sharing. You can find instructions for implementing this tag here.
Please note that it’s not possible to integrate this tag within the Global-e checkout.