Creating GTM Tags for Meta & GA4 via Templates
GTM Tags for Meta & GA4 Setup via Templates
To properly install the tags, triggers, and variables for Meta and GA4 within your Google Tag Manager, we have created templates for both server and web containers across five different platforms. These platforms are:
WordPress
Shopify
Shopify with Webhooks
WooCommerce
Lightspeed
For all these platforms, it is crucial that the ecommerce data layer is correctly installed.
You can find the templates for these platforms [here].
Once you’ve downloaded the JSON files for both the web and server containers, open your GTM web container. Navigate to ‘Admin,’ and click on ‘Import Container.’
Click on ‘Choose Container File’ and upload the JSON file for your web container. Choose your existing workspace and select ‘Overwrite.’
Various tags, triggers, and variables will be loaded, but these are just templates. You will need to customize the following components to make them work for your situation. Go to “Variables” and adjust the following ‘User-Defined’ constant variables:
”@GA4 ID”: In the ‘Value’ field, enter your GA4 Measurement ID. You can find this by going to Google Analytics, navigating to Admin, opening Data Streams, and selecting your data stream. There, you can copy your Measurement ID from the right side.
”@Server URL”: In the ‘Value’ field, enter the URL of your server. Replace ‘domeinnaam’ with your own domain name, resulting in “https://tagging.domeinnaam.nl”.
“232217644929196”: In the ‘Value’ field, enter your Meta Pixel ID. You can find this by going to your Meta Business Manager, opening your Events Manager, and selecting the correct pixel under Data Sources. Click on your Pixel ID in the overview on the right to copy it to your clipboard.
Now open the server container. Navigate to ‘Admin,’ and click on ‘Import Container.’
Click on ‘Choose Container File’ and upload the JSON file for your server container. Choose your existing workspace and select ‘Overwrite.’
Various tags, triggers, and variables will be loaded, but these are just templates. You will need to customize the following components to make them work for your situation. Go to
“Variables” and adjust the following ‘User-Defined’ constant variables:
”@FB Access Token”: In the ‘Value’ field, enter your Meta Access Token. You can find this by going to your Meta Business Manager, opening your Events Manager, selecting the correct pixel under Data Sources, navigating to Settings, and scrolling to the ‘Conversions API’ section. Here, you can generate an Access Token under ‘Manual Setup.’
”@FB Pixel ID”: In the ‘Value’ field, enter your Meta Pixel ID. You can find this by going to your Meta Business Manager, opening your Events Manager, and selecting the correct pixel under Data Sources. Click on your Pixel ID in the overview on the right to copy it to your clipboard.
”@GA4 ID”: In the ‘Value’ field, enter your GA4 Measurement ID. You can find this by going to Google Analytics, navigating to Admin, opening Data Streams, and selecting your data stream. There, you can copy your Measurement ID from the right side.
To properly install the tags, triggers, and variables for Meta and GA4 within your Google Tag Manager, we have created templates for both server and web containers across five different platforms. These platforms are:
WordPress
Shopify
Shopify with Webhooks
WooCommerce
Lightspeed
For all these platforms, it is crucial that the ecommerce data layer is correctly installed.
You can find the templates for these platforms [here].
How do I import these templates into my GTM containers?
Web Container
Once you’ve downloaded the JSON files for both the web and server containers, open your GTM web container. Navigate to ‘Admin,’ and click on ‘Import Container.’
Click on ‘Choose Container File’ and upload the JSON file for your web container. Choose your existing workspace and select ‘Overwrite.’
Various tags, triggers, and variables will be loaded, but these are just templates. You will need to customize the following components to make them work for your situation. Go to “Variables” and adjust the following ‘User-Defined’ constant variables:
”@GA4 ID”: In the ‘Value’ field, enter your GA4 Measurement ID. You can find this by going to Google Analytics, navigating to Admin, opening Data Streams, and selecting your data stream. There, you can copy your Measurement ID from the right side.
”@Server URL”: In the ‘Value’ field, enter the URL of your server. Replace ‘domeinnaam’ with your own domain name, resulting in “https://tagging.domeinnaam.nl”.
“232217644929196”: In the ‘Value’ field, enter your Meta Pixel ID. You can find this by going to your Meta Business Manager, opening your Events Manager, and selecting the correct pixel under Data Sources. Click on your Pixel ID in the overview on the right to copy it to your clipboard.
Server Container
Now open the server container. Navigate to ‘Admin,’ and click on ‘Import Container.’
Click on ‘Choose Container File’ and upload the JSON file for your server container. Choose your existing workspace and select ‘Overwrite.’
Various tags, triggers, and variables will be loaded, but these are just templates. You will need to customize the following components to make them work for your situation. Go to
“Variables” and adjust the following ‘User-Defined’ constant variables:
”@FB Access Token”: In the ‘Value’ field, enter your Meta Access Token. You can find this by going to your Meta Business Manager, opening your Events Manager, selecting the correct pixel under Data Sources, navigating to Settings, and scrolling to the ‘Conversions API’ section. Here, you can generate an Access Token under ‘Manual Setup.’
”@FB Pixel ID”: In the ‘Value’ field, enter your Meta Pixel ID. You can find this by going to your Meta Business Manager, opening your Events Manager, and selecting the correct pixel under Data Sources. Click on your Pixel ID in the overview on the right to copy it to your clipboard.
”@GA4 ID”: In the ‘Value’ field, enter your GA4 Measurement ID. You can find this by going to Google Analytics, navigating to Admin, opening Data Streams, and selecting your data stream. There, you can copy your Measurement ID from the right side.
Updated on: 15/08/2024
Thank you!