The Twenga Pixel tag needs to collect information related to tracked events (order confirmation, product display), this information must be stored in data layer variables so that the tag is able to access it.
In your Google Tag Manager, in the "Variables" tab, please check that there are data layer variables for the following information, by type of event:
For each of these information which is not already stocked in a Data Layer variable, you will need to create a new variable:
Here below, a Data Layer variable example for the reference product::
Another example, this time for the Data Layer variable containing the items of an order::
This step is only required if the new Data Layer variables were created at the previous step.
When a tracking event occurs, the Data Layer must be supplied with the information linked to the event.It must be done via Javascript code that we will call ‘Data Layer script’ which must be performed on every page where the tracking must be installed (product pages and/or transaction confirmation pages).
The Data Layer script must be placed <strong>ABOVE</strong> the Google Tag Manager tag in your pages => Google Tag Manager documentation
Here is an example of a Data Layer script for the product page:
window.dataLayer = window.dataLayer || []; dataLayer.push({ "ecommerce": { "detail": { "products": [{ "id": document.getElementById("product_info").getAttribute('data-id'), "price": document.getElementById("product_info").getAttribute('data-price') }] } } });
The script collects the information in the page and ‘pushes’ them into the appropriate Data Layer variables.
Please note, this is only an example, you must adapt this script according to the structure of your product page.
Here below, a Data Layer script example on the order confirmation page:
window.dataLayer = window.dataLayer || []; var aCollectedItems = []; var aItems = document.getElementsByClassName("item"); for (var i = aItems.length - 1; i >= 0; i--) { aCollectedItems.push({ 'id': aItems[i].dataset.id, 'variant_id': aItems[i].dataset.variant_id, 'quantity': aItems[i].dataset.qty, 'price': aItems[i].dataset.price }); } dataLayer.push({ 'ecommerce': { 'purchase': { 'actionField': { 'id': document.getElementById("order_info").getAttribute('data-order_id') }, 'products': aCollectedItems } } });
The script collects the information in the page and ‘pushes’ them into the appropriate Data Layer variables.
Please note that the script constructs a list of articles ‘aCollectedItems’ and for each article from this list, it fills in the following attributes: ‘id’, ‘price’, ‘quantity’ and ‘variant_id’ (this attribute is optional), it will be necessary to refer to these attribute names when installing the Twenga Pixel.
Please note, this is only an example, you must adapt this script according to the structure of your order confirmation page.
In your Google Tag Manager interface, in the ‘Templates"’ section, look for the "Twenga Pixel" tag template in the gallery and add it to the workspace. From this template, you must create a tag for each type of event: Product page and Order confirmation. The setting of the configuration fields is to be carried out only once for all the requested parameters; the settings of the product page as well as the settings of the transaction page. Only the triggers differentiate the two tags to deploy.
In your Google Tag Manager, in the tab ‘Tags’ then ‘New’, click on ‘Tag configuration’, Look for our ‘Twenga Pixel’ which should figure in the list of tag models and click on ‘Add to workspace’.Rename the tag ‘Twenga_product’.
You can now complete the tag configuration fields as follows:
Please note: The ‘references’ to the Data Layer variables are accessible via the button located next to the tag configuration input field. This functionality makes it possible to list the available variables and when selected, the reference to the variable will be automatically added to the input field in the form ‘{{name_of_variable}}’.
Example tag configuration for the product page:
In your Google Tag Manager, in the 'Tags' tab click on the tag that you created in the previous step, in the drop-down menu (located to the right of the ‘Save’ button) click on ‘Copy’. Rename the tag to ‘Twenga_transaction’. Modify the ‘event’ field by selecting ‘Transaction’.
Each tag should be associated with a trigger, depending on the type of event it is meant to be tracking.
The Twenga Pixel tag for product display events should be executed on any product page display. Our first suggestion is as follow.
Alternatively, there might be an already existing Data Layer variable that contains the type of the current page. If this is the case, you might create a trigger as follow:
You might very well use an existing trigger that is already configured to fire on the product page and associate it to the Twenga Pixel tag.
The Twenga Pixel for transaction confirmation events tag should be executed when a transaction has been completed.
We suggest creating this trigger the same way you created the one for product displays. Simply specify a string that appears in the transaction confirmation page's URL or the expected value of the 'page type' Data Layer variable for the transaction confirmation page.
Wir sammeln hauptsächlich Cookies, die für das reibungslose Funktionieren unserer Website unbedingt erforderlich sind und die es Ihnen ermöglichen, die wichtigsten Funktionen zu nutzen und in aller Ruhe zu surfen. Dazu gehören grundlegende Sicherheits- und Zugänglichkeitsfunktionen. Diese Cookies speichern keine personenbezogenen Daten.
Weitere Informationen finden Sie in unserer Datenschutzbestimmungen.
Wir bieten fortgeschrittene Lösungen zur Online-Akquise für mehr als 4500 Kunden in 16 Ländern.
Copyright Twenga 2025 - Alle Rechte vorbehalten