Google Tag Manager (GTM)

In this article, you'll learn what you need to know about using Google Tag Manager (GTM) with e-guma.

Linking Google Tag Manager with e-guma

You can link your Google Tag Manager account with e-guma. In e-guma select Settings -> Online shop -> Basic settings. Activate the field Google Tag Manager and enter your Container-ID. All Google Tag Manager Container-ID start with GTM-.

In this article by Google, you'll learn where to find your Container-ID in your Google Tag Manager account. Once you have linked e-guma with your Google Tag Manager, you can start adding tags in Google Tag Manager.

You can enter both the Google Analytics Measurement-ID and the Container-ID from Google Tag Manager. However, when using Google Tag Manager, we recommend that you integrate Google Analytics into Google Tag Manager and only enter the Container-ID from Google Tag Manager into your e-guma Backoffice. If you enter both IDs in e-guma, Google Analytics must not be integrated in the Tag Manager. This would otherwise lead to double counting. More information on Google Analytics you will find here.

Set up a tag

To be able to measure the number of visitors to your online shop, make the following settings in Google Tag Manager:

Create a tag of the type Google Analytics: GA4 Configuration in Google Tag Manager. An importable sample configuration of a GTM GA4 tag incl. e-commerce tracking can be downloaded in this section.

When integrating via Google Tag Manager, the standard code snippet from Google is included on every page. On the completion page, we store the order data in the dataLayer. Below is an example:

<script type="text/plain" data-cookiecategory="analytics">  
dataLayer = [];     
 
/*  We send two entries to the data layer. The former push is for Google Analytics 3 and the later for Google Analytics 4. */ 

	dataLayer.push(  {          
	'event': 'eguma.uapurchase',         
	'ecommerce': {               
		'purchase': {            
		'actionField': {                  
			'id': 'VOUCHER G10004',             
			'revenue': '20',              
		},             
		'products': [                                                    
					{                            
					'id': '35f5d3ef-c6ab-43fc-9931-4ba7843dd938',                            
					'name': 'Wertgutschein (Gutschein)',                                 
					'category': 'Gutschein',                            
					'price': '20',                            
					'quantity': 1                            
					},                 
		]            
		}        
	}       
	});

	dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.       
	dataLayer.push({            
		'event': 'purchase',            
		'ecommerce': {                
			'transaction_id': 'VOUCHER G10004',                
			'affiliation' : 'e-guma',                
			'value': 20,                
			'currency': 'CHF',                
			'items': [
					{  
					'item_name': 'Wertgutschein (Gutschein)',  
					'item_id': '35f5d3ef-c6ab-43fc-9931-4ba7843dd938',
					'price': 20,                            
					'item_category': 'Gutschein',                            
					'quantity': 1,                          ยจ
					}               
			]           
		}      
	});
</script>

E-Commerce-Tracking

The data in the e-commerce section of Google Analytics can be delayed by a few hours up to days. More info

It is also possible to record the vouchers/tickets sales in your online shop. Before you can use this function, you have to set up a according tag in Google Tag Manager.

Since this configuration is a bit more complex, we have created a sample configuration. This can be downloaded here. Please download this file and import it via the Admin function Import Container:

Remove the tags for Universal Analytics (UA). Then you have to replace the Google Analytics ID with your ID for all tags except for "GA4 - Event - Ecommerce events".

More details can be found in the Google Tag Manager user guide on e-commerce information.

No data will be sent to Google Analytics during the project phase. (The project phase ends upon go live),