Google Tag Manager Pixel Integration
Embed the tracking pixel using Google Tag Manager
Google Tag Manager Pixel Integration
This guide shows how to integrate the tracking pixel using Google Tag Manager (GTM).
Step 1: Login and Container Selection
Log in to your Google Tag Manager account and select the container where you want to add the script.
Step 2: Create a New Tag
- Navigate to Tags in the left menu
- Click New to add a new tag
- Give it a descriptive name (e.g., "Tracking Pixel")
Step 3: Configure Tag Type
- Click on the Tag Configuration field
- Select Custom HTML from the list
Step 4: Embed the Script
Paste the following code into the HTML field:
<script src="{{PIXEL_SCRIPT_URL}}" async></script>Replace
{{PIXEL_SCRIPT_URL}}with the actual script URL provided by your account manager.
Step 5: Configure Trigger
- Click on the Triggering field
- Select All Pages from the trigger list
Firing the Tag After User Consent
If your website requires user consent for tracking (for example under GDPR), fire the tag only after the user has given consent:
- Instead of All Pages, use a trigger based on the event your consent management platform (CMP) pushes to the
dataLayerwhen consent is available, for example a Custom Event trigger with a condition on the consent category required for advertising or marketing - Make sure the trigger fires both on page load for users who gave consent on an earlier visit and right after the user gives consent on the current page
- In the tag, open Advanced Settings > Tag firing options and select Once per page
Example: Google Consent Mode
If your CMP supports Google Consent Mode v2, you can use the built-in consent checks in GTM instead of a condition on CMP categories:
- In the tag, open Advanced Settings > Consent Settings, select Require additional consent for tag to fire and add
ad_storage,ad_user_dataandad_personalization - Under Triggering, add two triggers:
- All Pages, for users who gave consent on an earlier visit
- A Custom Event trigger on the event your CMP pushes when the user gives or changes consent
- In Advanced Settings > Tag firing options, select Once per page
GTM checks consent only when a trigger fires. If consent is given after the page has loaded, the tag fires on the CMP event instead of All Pages.
E-commerce events pushed to the dataLayer before the tag fires are still processed, so events from the current page are not lost.
Step 6: Save and Publish
- Click Save to save your tag
- Click Submit to publish the changes
- Add a version name and description
- Click Publish
Verification
After publishing:
- Use GTM Preview mode to verify the tag fires correctly
- Check the Network tab in Developer Tools to confirm the script loads
- Verify e-commerce events are being captured
Updated about 1 month ago
