How to set up a tag manager for user tracking?

How to set up a tag manager for user tracking?

Tag Manager is used to track user events in various tracking systems. Here you can find the instruction to connect your Meta Pixel and Google Analytics.

When does this apply?

When one of our systems asks you to specify a Tag Manager ID, you can find it here. This is a container ID and should be used as a tag manager ID. If you don’t have one, use the instructions below to create one:

How to create an account

Go to, click Create Account. Then fill in your data and pick Web as the target platform:

Setting up Google Analytics from the tag managers side

Setting up variables

Click on Variables in the menu on the left, then in the User-Defined Variables section click New.

Enter the nae of the variable as in the example and click on choose a variable.

Click on Variable Configuration and select Data Layer Variable.

Set the name as ‘ecommerce.affiliation’. Set the Data Layer Variable name as ‘ecommerce.affiliation’. Click Save.

Keep adding variables. There should be 5 such variables in total: ecommerce.affiliation, ecommerce.currency, ecommerce.items, ecommerce.transaction_id, ecommerce.value. The result should look like this:

This completes setting up the variables.

Setup of the trigger

Go to Triggers on the left menu, then pick New. Set the Event name to ‘purchase’.

In the Choose Trigger Type menu pick Other - Custom Event (you will need to scroll down)

Then press Save and this completes the trigger setup.

Setting up tags in Google Analytics

Go to Tags in the menu on the left and click on New.

Click on Tag Configuration and pick Google Analytics:

Then click on Google Analytics: GA4 Event

Next you need to set: Measurement ID - your Measurement ID and your Google Analytics; Event Name should be ‘purchase’.

Open the Event Parameters list and click on Add Parameter.

Name the first Event parameter ‘items’ and click on the value button.

Choose ‘ecommerce.items’

Repeat the same step for the other parameters, following this way:

items - {{ecommerce.items}}
affiliation - {{ecommerce.affiliation}}
currency - {{ecommerce.currency}}
transaction_id - {{ecommerce.transaction_id}}
value - {{ecommerce.value}}

Next, click Triggering and select Custom Event.

Click Save.

Setting up Google Analytics

This is needed so that you can accurately track the source of the purchase - organic search, direct, or other. Open your Google analytics page.

Select Admin in the bottom left then Data Streams.

Scroll down and select Configure tag settings:

Click on Configure Your Domains:

Click on Add Condition and put Match type: Contains, Domain: ‘’.

Then click Save at the top. This concludes setting up the tag manager for google analytics.

Setting up tag manager for facebook (optional)

Go to the Tags section in the tag manager and in Tag Configuration select Custom HTML.

In the HTML field, input the tracking code received from Facebook. Under Firing triggers select.

As a trigger, choose All Pages - Page View.

Now create another tag with the type Custom HTML. Choose the trigger - Custom Event (which was created for Google Analytics) In the HTML field enter the tracking code:

<script> fbq('track', 'Purchase', {value: '{{GA4 / ecommerce.value}}', currency: '{{GA4 / ecommerce.currency}}'}); </script>

This completes the setup.

Any questions? Reach out at