An explanation of how PromoCat's integration with Google Tag Manager works to measure e-commerce conversions.
How does the Google Tag Manager integration work?
PromoCat has built an integration for Google Tag Manager based on a purchase event. Using parameters, this event measures the values (product name, price, etc.) added to an order or quote. This set of parameters is called the data layer.
Example of the data layer created based on an order (item: tape measure):
gtag("event", "purchase", {
"transaction_id": "177",
"value": "368.294500",
"tax": "63.344500",
"shipping": "12.000000",
"currency": "EUR",
"items": [
{
"item_id": "LT90442_N0002",
"item_name": "Rolmaat 3m - Zwart",
"affiliation": "Order",
"item_category": "Rolmaten",
"price": "3.460600",
"quantity": "100"
}
]
});
This data layer is not visible in the code on the shopping cart page: it is only activated (triggered) when an actual order is placed, and fires as soon as the thank-you page is reached.
Distinguishing between order and quote
To measure the right conversions, it's important to know whether it concerns an order or a quote. This can be done in 2 ways.
1. Values within the data layer
The affiliation field is always sent within the data layer. This field has 2 possible values: Order or Offer. By reading this value, you can determine whether it concerns an order or a quote.
2. Setting up the thank-you page URL
If it's not possible to read the values within the data layer, paths can be set up. As soon as path A is reached, it concerns an order; with path B, a quote.
These paths are set up by creating a 'goal' with a destination:
Type | Step | Path |
Order (A) | 1 – Shopping cart |
|
Order (A) | 2 – Thank-you page |
|
Quote (B) | 1 – Quote basket |
|
Quote (B) | 2 – Thank-you page |
|
After setting this up, you can filter on the goal 'Order' or 'Quote'.
More information: Setting up Google Analytics goals
How do I activate measurements via Google Tag Manager?
For this you need a Google Tag Manager account and access to the webshop's CMS.
In the CMS, go to Instellingen (Settings) and navigate to the SEO tab.
In the Google Tag Manager field, enter your own GTM code and tick the Ecommerce tracking setting. Only enter the GTM code here (GTM-.......).
Link Google Tag Manager to the webshop and then set up the correct parameters (events) within Google Analytics, so that the desired values are measured and end up in Google Analytics. See: [GA4] Modify and create events in Google Analytics.
Important: has a script or code been placed on the site manually? Remove it to avoid conflicts. You can easily do this in PromoCat's code editor.
See documentation: How do I edit the head, CSS or JavaScript?
