Before setting up, you need to get a Google Analytics 4 measurement ID. How to do this is described here:
You also need to connect a GTM container to your website. How to do this is described in our instructions:
Actions in the GTM admin panel
To connect Google Analytics in the GTM container, you need to configure the Google tag. To do this, go to the Tag Manager in the settings of the container you are working with:
Go to the Tags section, and then click New.
In the Tag Configuration box, select the Google Tag.
In the Tag ID field, add your GA4 measurement ID.
In the Triggering box, set the tag to the standard All Pages trigger.
Click Save.
After creating the tag, you need to publish the container by clicking Submit and then Publish in the window that opens.
You can check the tag's performance either by using the preview mode of the Tag Manager or by using the Google Tag Assistant, a specialized plugin for the Chrome browser.
Note: If you have set up Google Analytics, Facebook Pixel, or other systems through GTM, you do not need to enable these systems separately on your website in the Marketing systems section.
DataLayer standard events
Cartum stores have implemented the transfer of information about standard events necessary for tracking customer behavior on the website and ecommerce in Google Analytics using the DataLayer.
The following standard events are currently transmitted:
Visiting a catalog page ("event": "view_item_list")
Visiting a product page ("event": "view_item")
Adding a product to the cart ("event": "add_to_cart")
Removing a product from the cart ("event": "remove_from_cart")
Starting checkout ("event": "begin_checkout")
Successful checkout ("event": "purchase")
Requesting callback ("event": "callbackRequest")
Full information on the format and parameters of events can be found in Google's documentation:
Events for enhanced ecommerce do not allow the transfer of data on the product category and brand, but we plan to improve this functionality.
Important: in Cartun, the Successful checkout event is dynamic and is triggered when buyer clicks on the Checkout button. This implementation is necessary for the correct recording of a successful order, if immediately after its placement the buyer is automatically redirected to the order payment page in the payment service..
If you have previously configured data transfer to Google Analytics via GTM, then events in the old format also work correctly. If you are planning to reconfigure GTM to the new event format, please contact the support team to switch the project to transfer events in GA4 formats.
Transferring an event to Analytics
Below is an example of setting up the transmission of one of the events — Adding an item to the cart — to the Analytics. When a customer adds a product to the cart, the standard addToCart event is transmitted at the data level.
dataLayer.push({ ecommerce: null });
dataLayer.push({
"event": "add_to_cart",
"ecommerce": {
"items": [
{
"item_id": model.article + "",
"item_name": model.title + " (SKU: " + model.article_for_display + ")",
"price": model.price * 1,
"currency": GLOBAL.currency.iso,
"quantity": model.quantity
}
]
}
});
For an event to be registered in Analytics, you need to perform the steps below.
In the GTM container, create a variable:
In the Variables section, in the User-Defined Variables box, create a new variable of the Custom event type.
Create an add_to_cart trigger:
In the Triggers section, create a new trigger. Set a clear name for the trigger and select the Custom event activator type.
In the Event Name field, insert the label add_to_cart. In the Trigger condition, select Some custom events.
In the Fire this trigger when an Event occurs and all of these conditions are true block, set the Custom event, equals, add_to_cart values.
Save the trigger.
Create an add_to_cart tag:
In the Tags section, select New and give the tag a clear name.
In the Tag Configuration box, select Google Analytics: GA 4 event.
In the tag settings, enter the Google Analytics 4 Measurement ID and in the Event Name field, enter add_to_cart.
Check the Send Ecommerce data box in the More settings → Ecommerce section and select Data Layer as the Data source .
In the Triggering box, select the previously created add_to_cart trigger of the Custom event type.
Save the tag.
After creating the tag, you need to publish a new version of the container on your website.
Checking data transmission
You can check if the tag is triggered when adding a product to the cart in the preview mode.
To check the transfer of an event to Analytics, go to the Analytics account in Reports → Real-time overview → Event count by Event name.
Cartum ready-made GTM configuration
You can import a ready-made configuration file into your GTM container for the events that Cartum sends to the DataLayer.
Important: This configuration file contains the complete settings for event transmission, including a ready-made Google tag. If you've already started setting up event transmission manually, you don't need to download the configuration file.
How to import
Create a GTM account or log in to an existing one.
Go to the Admin tab and select Import Container in the Container column.
Upload the JSON configuration file and select the appropriate settings depending on your needs. If the account is new and there are no settings yet, then select a workspace and import the file. If there are settings in GTM, it is advisable to create a separate workspace for importing.
Replacing the identifier
After importing the configuration, be sure to replace the measurement ID in all tags, starting with the Google tag:
Go to the Tags section and click on the GA4 - NEW Google tag name to edit.
Change the G-0000000000 identifier to your GA4 measurement identifier.
Click Save.
Repeat this procedure for all tags of the Google Analytics: GA4 Event type.
Publish the container.