> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.bglobale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Global‑e and Marketing Pixels

With the Global-e solution installed, your store has now two types of checkouts, the standard checkout for your local customers and the Global-e checkout for your international customers.

<Frame>
  <img src="https://mintcdn.com/globale-enterprise/X_jditTJssq_GTcj/images/uuid-6ee60619-5608-be5a-cb49-39a73a1171d2.png?fit=max&auto=format&n=X_jditTJssq_GTcj&q=85&s=30745291b0025c75258d6a9fa00ceeab" width="542" height="669" data-path="images/uuid-6ee60619-5608-be5a-cb49-39a73a1171d2.png" />
</Frame>

This document provides you, the merchant, with the basic instructions required to implement tracking events on your website.

**MEASURING PLATFORM EVENTS**

To measure marketing platform events on the Global-e checkout, you must add the pixels or tags of the relevant marketing platforms to the pages containing Global-e checkout, as described in this document

**RELATED DOCUMENTATION**

For detailed technical documentation, see [Global‑e Order Transaction Support for Analytics](https://globaleonline.sharepoint.com/:b:/s/ExternalSharing/EWp5dIaJPDlDsb0nxyIztBEBNK0mx53s1ietW6HP4BlK0w?e=KWRvuu)

## Adding Pixels to the Global‑e Checkout

Global‑e provides a JavaScript callback function (`“OnCheckoutStepLoaded`”) that holds the checkout and order information in a **data** object. You can use this callback to trigger events both when the Global‑e checkout is loaded or complete.

**To embed pixels in the Global-e checkout:**

1. [Edit the OnCheckoutStepLoaded callback function](/document/preview/129823#UUID-446d3540-79c6-f4b6-d646-30993f16b60e) by adding the relevant pixel snippets to the callback function.**1. Edit the OnCheckoutStepLoaded Callback Function**

2. [Place the final OnCheckoutStepLoaded callback function on your site](/document/preview/129824#UUID-fad50219-0e3d-7347-ecb5-b817b6f375bb).**2. Place the Final OnCheckoutStepLoad Callback on your Site**

3. **Edit the OnCheckoutStepLoaded Callback Function**

   The following code snippet presents the subscription to the `OnCheckoutStepLoaded` callback function. Note that this code currently does not contain any pixels.

   **data.Steps.LOADED\*\*\*\*loaded**, while the **data.Steps.CONFIRMATION** case is executed when the Global‑e checkout has been **completed**.

   ```
    <script>

   var glegem = glegem || function() {
   ((window["glegem"] = window["glegem"] || {q:[]}).q = window["glegem"].q || []).push(arguments);};var glegem = window["glegem"] || function () {
       (window["glegem"].q = window["glegem"].q || []).push(arguments);
   };
   glegem("OnCheckoutStepLoaded", function (data) {
       switch (data.StepId) {
       case data.Steps.LOADED:
        // ******************************************* // 
        // ** ADD CHECKOUT LOADED EVENT PIXELS HERE ** //
        // ******************************************* //
           break;
       case data.Steps.CONFIRMATION:
           if (data.IsSuccess && !data.IsPageReload) {
              // *********************************************************** //
              // ** ADD CHECKOUT COMPLETED/CONFIRMATION EVENT PIXELS HERE ** //
              // *********************************************************** //
           }
           break;
       }
   });
   </script >
   ```

   We recommend deferring the Global-e scripts until after the entire document has been parsed. Hopefully, this will allow any analytics code to load onto the page before the Global-e analytics scripts load.

   If the above recommendations do not improve the situation, we recommend you add your analytics code to the source of the checkout page, assuming there are no reasons preventing that from happening.

   **Converted price analytics**

   You may need to capture converted prices in analytics that run on your product page and other pages before checkout. To do this, there is an event that triggers after the prices on the page are converted. You can subscribe to this event, and after it triggers, you can execute your analytics, so you are able to retrieve the converted prices.

   ```
   window['GlobalE_Prices_Conversion_Complete'] = function() { console.log('GE prices conversion complete')};
   ```

   As mentioned, the callback returns a data object in JSON format that contains information about the checkout, such as item prices and quantities, order total, and currency. Use the variables in the JSON data object to configure your pixel.

   See [Data Object Confirmation Step (JSON)](/global-e-and-marketing-pixels#data-object-confirmation-step--json-) for an example.

   Use the relevant [data object variables](/global-e-and-marketing-pixels#common-data-object-variables) to add pixels to the LOADED step, the CONFIRMATION step, or both.

   The following examples show how this is edited or amended for each marketing platform.

   | **Platform**                    | **Event**            | **Example**                                                                                                         |
   | ------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------- |
   | Google Tag Manager (Data Layer) | `Purchase` Event     | [Google Tag Manager (Purchase Data Layer)](/global-e-and-marketing-pixels#google-tag-manager--purchase-data-layer-) |
   | Google Ads (gtag)               | `Conversion` Event   | [gtag - Conversion Event](/global-e-and-marketing-pixels#gtag---conversion-event)                                   |
   | TikTok                          | `PlaceAnOrder` Event | [TikTok - PlaceAnOrDer Event](/global-e-and-marketing-pixels#tiktok---placeanorder-event)                           |

4. **Place the Final OnCheckoutStepLoad Callback on your Site**

   **To implement the final OnCheckoutStepLoad callback on your site:**

   `OnCheckoutStepLoaded`online store, in the `head` element.

   Note that the callback function is **only** initiated when the Global‑e checkout is loaded or complete, even though the function is implemented on every page of your site.

### Common Data Object Variables

The following table lists the most common data object variables used in marketing platforms events:

| **Variable Definition**                            | **Variable JSON Path**                                                           |
| -------------------------------------------------- | -------------------------------------------------------------------------------- |
| Global‑e Order Id                                  | `data.details.OrderID`                                                           |
| The merchant currency: The Store currency          | `data.details.MerchantCurrencyCode`                                              |
| Order products total (in merchant currency)        | `data.details.OrderPrices.MerchantTransaction.TotalProductsPrice`                |
| Single product sale price (in base Store currency) | `data.details.ProductInformation[i].ProductPrices.MerchantTransaction.SalePrice` |
| Single product quantity                            | `data.details.ProductInformation[i].Quantity`                                    |
| Single product SKU                                 | `data.details.ProductInformation[i].SKU`                                         |

See [Global‑e Order Transaction Support for Analytics](https://globaleonline.sharepoint.com/:b:/s/ExternalSharing/EWp5dIaJPDlDsb0nxyIztBEBNK0mx53s1ietW6HP4BlK0w?e=KWRvuu) for the complete list of variables.

## Google Tag Manager (Purchase Data Layer)

```
<script>
var glegem = glegem || function() {
((window["glegem"] = window["glegem"] || {q:[]}).q = window["glegem"].q || []).push(arguments);};var glegem = window["glegem"] || function () {
    (window["glegem"].q = window["glegem"].q || []).push(arguments);
};
glegem("OnCheckoutStepLoaded", function (data) {
    switch (data.StepId) {
    case data.Steps.LOADED:
        break;
    case data.Steps.CONFIRMATION:
        console.log(data);
        if (data.IsSuccess && !data.IsPageReload) {
            if (typeof dataLayer !== "undefined") {
                let products = new Array();
                for (let temp = 0;
                    temp < data.details.ProductInformation.length; temp++) {
                    let tempProducts = {};
                    tempProducts.id =
                         data.details.ProductInformation[temp].SKU;
                    tempProducts.name =
                        data.details.ProductInformation[temp].ProductName;
                    tempProducts.price = data.details.ProductInformation[temp].
                        ProductPrices.MerchantTransaction.SalePrice;
                    tempProducts.quantity =
                        data.details.ProductInformation[temp].Quantity;
                    products.push(tempProducts);
                }
                var couponCode = '';
                var discountAmount = '';
                for (let temp = 0; temp < data.details.Discounts.length; temp++) {
                    if (data.details.Discounts[temp].CouponCode !=
                        '' && data.details.Discounts[temp].DiscountTypeId == 1) {
                        couponCode =
                            data.details.Discounts[temp].CouponCode;
                        discountAmount =
                            data.details.Discounts[temp].
                            DiscountPrices.MerchantTransaction.Price;
                    }
                }
                dataLayer.push({
                    'event': 'purchase_GE',
                    'ecommerce': {
                        'purchase': {
                            'actionField': {
                                'id': data.OrderId,
                                'revenue':
                                data.details.OrderPrices.
                                MerchantTransaction.TotalProductsPrice,
                                'coupon': couponCode,
                                'discountAmount': discountAmount
                            },
                            'products': products
                        },
                        "currencyCode": data.details.MerchantCurrencyCode,
                    }
                });
            }
        }
        break;
    }
});
</script>
```

## gtag - Conversion Event

```
<script>
var glegem = glegem || function() {
((window["glegem"] = window["glegem"] || {q:[]}).q = window["glegem"].q || []).push(arguments);};var glegem = window["glegem"] || function () {
    (window["glegem"].q = window["glegem"].q || []).push(arguments);
};
glegem("OnCheckoutStepLoaded", function (data) {
    switch (data.StepId) {
    case data.Steps.LOADED:
        break;
    case data.Steps.CONFIRMATION:
        if (data.IsSuccess && !data.IsPageReload) {
            gtag('event', 'conversion', {
                'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
                'value': data.details.OrderPrices.
                MerchantTransaction.TotalProductsPrice,
                'currency': data.details.MerchantCurrencyCode,
                'transaction_id': data.OrderId,
            });
        }
        break;
    }
});
</script>

```

## TikTok - PlaceAnOrDer Event

```
<script>
var glegem = glegem || function() {
((window["glegem"] = window["glegem"] || {q:[]}).q = window["glegem"].q || []).push(arguments);};var glegem = window["glegem"] || function () {
    (window["glegem"].q = window["glegem"].q || []).push(arguments);
};
glegem("OnCheckoutStepLoaded", function (data) {
    switch (data.StepId) {
    case data.Steps.LOADED:
        break;
    case data.Steps.CONFIRMATION:
        if (data.IsSuccess && !data.IsPageReload) {
            let products = new Array();
            for (let temp = 0; temp < 
                data.details.ProductInformation.length; temp++) {
                let tempProducts = {};
                tempProducts.Content_id = 
                    data.details.ProductInformation[temp].SKU;
                tempProducts.Content_name = 
                     data.details.ProductInformation[temp].ProductName;
                tempProducts.Price =
                    data.details.ProductInformation[temp].
                    ProductPrices.MerchantTransaction.SalePrice;
                tempProducts.Quantity =
                     data.details.ProductInformation[temp].Quantity;
                tempProducts.Currency = data.details.MerchantCurrencyCode;
                products.push(tempProducts);
            }
            ttq.track('PlaceAnOrder', {
                'contents': products,
                'value':
                     data.details.OrderPrices.MerchantTransaction.TotalProductsPrice,
                'currency': data.details.MerchantCurrencyCode
            });
        }
        break;
    }
});
</script> 
```

## Data Object Confirmation Step (JSON)

The following example illustrates the data object confirmation step in JSON format.

```
{
    "data": {
        "Steps": {
            "LOADED": 0,
            "CONFIRMATION": 4
        },
        "IsSuccess": true,
        "OrderId": "GE158530011GB",
        "MerchantOrderId": null,
        "AuthCode": 5,
        "StepId": 4,
        "details": {
            "OrderID": "GE158530011GB",
            "MerchantOrderID": null,
            "ReplacementOrder": false,
            "CustomerCurrencyCode": "EUR",
            "MerchantCurrencyCode": "GBP",
            "IsEU": false,
            "CustomerDetails": {
                "ShippingAddress": null,
                "BillingAddress": null
            },
            "HubCountryCode": "GB",
            "Region": null,
            "SiteURL": "https://andrii-sh12.myshopify.com",
            "DutiesGuaranteed": true,
            "ShippingMethodName": "DHL",
            "ShippingMethodType": "Express Courier (Air)",
            "DeliveryDaysRangeFrom": 2,
            "DeliveryDaysRangeTo": 2,
            "OrderPrices": {
                "MerchantTransaction": {
                    "EstimatedTotalPrice": 0.43,
                    "TotalProductsPrice": 2.98,
                    "TotalDiscountedProductsPrice": 2.98,
                    "EstimatedShippingCost": 2.55,
                    "ShippingVATRate": 0,
                    "DutiesAndTaxes": 0,
                    "ProductTotalVAT": 0.5,
                    "TotalVAT": 0.5,
                    "RemoteAreaSurchargeFee": 0
                },
                "MerchantTransactionExcludingLocalVAT": {
                    "EstimatedTotalPriceExcludingVAT": -0.07,
                    "TotalProductsPriceExcludingVAT": 2.48,
                    "TotalDiscountedProductsPriceExcludingVAT": 2.48,
                    "EstimatedShippingCostExcludingVAT": 2.55,
                    "CustomerShippingPriceExcludingVAT": 15,
                    "DutiesAndTaxesExcludingVAT": 0,
                    "RemoteAreaSurchargeFeeExcludingVAT": 0
                },
                "CustomerTransaction": {
                    "CustomerTotalPrice": 17.95,
                    "CustomerTotalProductsPrice": 2.95,
                    "CustomerTotalDiscountedProductsPrice": 2.95,
                    "CustomerShippingPrice": 15,
                    "CustomerDutiesAndTaxes": 0,
                    "CustomerTotalVAT": 0,
                    "CustomerShippingVATRate": 0,
                    "CustomerUSSalesTax": 0,
                    "Fees": {
                        "CustomerCCF": 0,
                        "CustomerCODFee": 0,
                        "CustomerDangerousGoodsFee": 0,
                        "CustomerSizeOverchargeFee": 0,
                        "CustomerRemoteAreaSurchargeFee": 0
                    }
                },
                "CustomerTransactionInMerchantCurrency": {
                    "CustomerTotalPriceInMerchantCurrency": 15.56,
                    "CustomerTotalProductsPriceInMerchantCurrency": 2.56,
                    "CustomerTotalDiscountedProductsPriceInMerchantCurrency": 2.56,
                    "CustomerShippingPriceInMerchantCurrency": 13,
                    "CustomerVATInMerchantCurrency": 0,
                    "CustomerShippingVATRate": 0,
                    "CustomerDutiesAndTaxesInMerchantCurrency": 0,
                    "CustomerUSSalesTaxInMerchantCurrency": 0,
                    "Fees": {
                        "CustomerCCFInMerchantCurrency": 0,
                        "CustomerCODFeeInMerchantCurrency": 0,
                        "CustomerDangerousGoodsFeeInMerchantCurrency": 0,
                        "CustomerSizeOverchargeFeeInMerchantCurrency": 0,
                        "CustomerRemoteAreaSurchargeFeeInMerchantCurrency": 0
                    }
                }
            },
            "ProductInformation": [{
                    "ProductName": "Blue T-Shirt test",
                    "ProductURL": 
                        "https://sh15.myshopify.com/products/
                                 blue-t-shirt?variant=38153717350595",
                    "Categories": null,
                    "Brand": null,
                    "SKU": "66466",
                    "ProductGroupCode": "6254011384003",
                    "SecondaryProductCode": null,
                    "Quantity": "1",
                    "CartItemId": "38153717350595:00db6f4e2962eae384bbdac28ed08472",
                    "ProductCouponCodes": null,
                    "ParentCartItemID": null,
                    "CartItemOptionId": null,
                    "MetaData": [{
                            "AttributeKey": "size",
                            "AttributeValue": "L"
                        }, {
                            "AttributeKey": "size",
                            "AttributeValue": "L"
                        }
                    ],
                    "ProductAttributes": null,
                    "ProductPrices": {
                        "MerchantTransaction": {
                            "ListPrice": 2.98,
                            "SalePrice": 2.98,
                            "TotalPrice": 2.98,
                            "VATRate": 20,
                            "DiscountedPrice": 2.98
                        },
                        "MerchantTransactionExcludingLocalVAT": {
                            "ListPriceExcludingVAT": 2.48,
                            "SalePriceExcludingVAT": 2.48,
                            "TotalPriceExcludingVAT": 2.48,
                            "DiscountedPriceExcludingVAT": 2.48
                        },
                        "CustomerTransaction": {
                            "CustomerListPrice": 2.95,
                            "CustomerSalePrice": 2.95,
                            "CustomerTotalPrice": 2.95,
                            "CustomerVATRate": 0,
                            "CustomerDiscountedPrice": 2.95
                        },
                        "CustomerTransactionInMerchantCurrency": {
                            "CustomerListPriceInMerchantCurrency": 2.56,
                            "CustomerSalePriceInMerchantCurrency": 2.56,
                            "CustomerTotalPriceInMerchantCurrency": 2.56,
                            "CustomerDiscountedPriceInMerchantCurrency": 2.56
                        }
                    }
                }
            ],
            "PaymentMethods": [{
                    "PaymentMethodName": "Visa",
                    "PaymentMethodCode": "1"
                }
            ],
            "Discounts": [{
                    "Description":
                       "Shipping discount provided from fixed price range 443543",
                    "DiscountCode": null,
                    "DiscountTypeId": 2,
                    "DiscountTypeName": "Shipping discount",
                    "CouponCode": "",
                    "ProductCartItemId": null,
                    "DiscountPrices": {
                        "MerchantTransaction": {
                            "Price": 2.55,
                            "VATRate": 0
                        },
                        "MerchantTransactionExcludingLocalVAT": {
                            "PriceExcludingVAT": 2.55
                        },
                        "CustomerTransaction": {
                            "CustomerPrice": 3.03,
                            "CustomerVATRate": 0
                        },
                        "CustomerTransactionInMerchantCurrency": {
                            "CustomerPriceInMerchantCurrency": 2.63,
                            "CustomerVATRate": 0
                        }
                    }
                }
            ],
            "OrderPaymentMethods": [{
                    "PaymentMethodId": 1,
                    "PaymentMethodName": "Visa",
                    "IsGiftCard": false,
                    "GiftCardFields": null,
                    "PaidAmountInCustomerCurrency": 17.95,
                    "PaidAmountInMerchantCurrency": 15.115259535867043
                }
            ],
            "cultureCode": "en-GB",
            "InitialCheckoutCultureCode": "en-GB",
            "URL": null,
            "CustomURL": null,
            "CheckoutStep": null,
            "MerchantID": 10000085,
            "Title": "Global‑e Order Transaction",
            "HostName": "https://qa.bglobale.com/",
            "CustomHostName": null,
            "PageType": 0,
            "CartToken": "697ed452-a5a0-4ee2-b3a0-714b7b053158",
            "CountryCode": "DE",
            "UrlReferer": null,
            "DoLog": false
        }

    }
}

```

## Converted price analytics

You may need to capture converted prices in analytics that run on your product page and other pages before checkout. To do this, there is an event that triggers after the prices on the page are converted. You can subscribe to this event, and after it triggers, you can execute your analytics, so you can retrieve the converted prices.

```
window['GlobalE_Prices_Conversion_Complete'] = function() { console.log('GE prices conversion complete')};
```
