Let visitors switch each Google Tag Manager tag on or off
Create one TermsFeed Privacy Consent (CMP) vendor per Google Tag Manager tag, and let its on-accept vendor tag push a data layer event that fires the tag. Visitors then see each tool by name in the Preferences Center and switch it on or off alone. The event reaches Google Tag Manager with no callback code, because Privacy Consent inserts the vendor tag when the visitor accepts and on every later page load. The setup takes 5 steps and about 5 minutes per tag.
When each Google Tag Manager tag gets its own vendor
Give a tag its own vendor when visitors need a choice per tool, or when the tag has to follow what Privacy Consent runs instead of what the visitor saved. This approach suits a container with a handful of tracking tags from different companies.
- Visitors choose per tool, such as accepting Google Analytics 4 while declining Hotjar, and your Cookies Policy lists each tool by name.
- Tags follow the opt-out model, where Privacy Consent runs every vendor with no answer saved and the vendor event still fires.
- Returning visitors fire the tag on every page with no code in the head of your site.
- A tag belongs to a different vendor category from the tags around it, so a callback that reports whole vendor categories does not describe it.
Each tag needs one vendor, one event name, and one trigger. The TermsFeed app limits the number of vendors on a consent banner: at the limit, the "Vendors" page hides "Add a vendor" and shows "Vendor limit reached". A container with dozens of tags fits the vendor category approach better, with Data Layer Events.
Step 1: Add a custom vendor for the tool the tag serves
Open "Vendors" in the TermsFeed app, click "Add a vendor", and click the "Custom vendor" card. Fill in "Vendor name" with the tool, such as Google Analytics 4, then "Link to their Privacy Policy", "What are they used for?" (the vendor category), and "Purpose". Choose the vendor category from what the tool does with the data, never from what the container does.
A new vendor on a live consent banner asks visitors who already answered again, on the opt-in model. Add every vendor for your container in one session, then plan for the new question with Vendors Added After Launch.
Step 2: Paste the data layer push into the on-accept vendor tag
Open the "JavaScript tags" tab of the vendor, switch on "If allowed", and paste this push. Give each vendor its own event name, in lowercase with underscores, so its trigger matches that vendor alone.
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'tf_vendor_google_analytics' });
</script>
A tag that reacts to a refusal gets a second push in the "If declined" slot of the same tab. Then click "Add vendor".
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'tf_vendor_google_analytics_declined' });
</script>
Step 3: Create a Custom Event trigger for the vendor event
In Google Tag Manager, open Triggers, click New, choose Custom Event, and enter tf_vendor_google_analytics as the Event name. Keep All Custom Events selected, name the trigger TF Vendor - Google Analytics 4, and save it.
Step 4: Make the vendor event the only trigger of the tag
Open the tag, remove All Pages and every other trigger from Triggering, and add TF Vendor - Google Analytics 4. A tag that needs another tag first, such as a Google Analytics 4 event tag that needs the Google tag, gets that order from Tag Sequencing under Advanced Settings.
Step 5: Check that each vendor event fires its tag after consent
Run this check on a visit that shows the consent banner, and close every private window before the second visit. A new private window has no cached settings, so it gets the vendor you saved.
- Sign in to Google Tag Manager in a new private window, click Preview, and enter your site address. The event list does not show
tf_vendor_google_analyticsbefore you answer, and the tag sits under Tags Not Fired. - Open Chrome DevTools on your site, select the Network tab, and type
google-analytics.comin the filter box, or the host of the tag. No request appears before you answer. - Click I Agree. The event list shows
tf_vendor_google_analytics, the tag moves to Tags Fired, and the Network tab shows thegoogle-analytics.comrequest. - Select the Elements tab and search for
termsfeed-pc1-vendor-tag-id=, with each match naming a vendor. The push script sits in the head, with the attribute set to the vendor ID followed by-javascript. - Close every private window, repeat step 1, click I Decline, and reload. The on-accept event never appears, the on-decline event appears if you added one, and the Network tab stays empty for
google-analytics.com.
Why each setting in the vendor event setup is there
Each setting keeps the tag waiting for consent or keeps the event reliable, and this comparison gives the reason for each one.
| Setting | Value | Why |
|---|---|---|
| Vendor category | The purpose of the tool | The Preferences Center groups the vendor there, and accepting the vendor category accepts the vendor |
| Slot | "JavaScript tags", "If allowed" | The slot runs after consent or on the opt-out model, and an on-load slot runs for every visitor before any answer |
window.dataLayer = window.dataLayer || [] |
First line of the push | The push works before the container loads, and Google Tag Manager reads the earlier messages when it starts |
| Event name | One per vendor | The trigger matches only the vendor the visitor accepted |
<noscript> fallback |
Left out | It fires for visitors with JavaScript turned off, who never see the consent banner |
| Tag firing options | The default | Privacy Consent inserts an on-accept vendor tag once per page view, so a second answer does not send a second event |
How Privacy Consent orders vendor events
Privacy Consent runs vendors in a fixed order, and no setting in the app changes it. It starts the vendor tags by vendor category: Essential, Functionality, Analytics, Advertising, then Marketing. Inside a vendor category it follows the order the server lists them, and the "Vendors" page has no reordering.
The vendor events reach the data layer in that order, a moment apart. Build each vendor tag so it works alone, with its own window.dataLayer line, and put every dependency between tags in Tag Sequencing. Check how vendors run in Add a Custom Vendor.
What returning visitors and withdrawal do to vendor events
A returning visitor who accepted fires the vendor event on every page load, once Privacy Consent has loaded its settings. The event arrives later than the Google Tag Manager page view, because Privacy Consent first downloads its scripts and settings. A returning visitor who declined fires the on-decline event on every page load, if you added one.
A visitor who withdraws consent in the Preferences Center sees nothing change on that page. The tag that already fired keeps running, the on-decline event does not fire on that page, and Privacy Consent does not delete the cookies the tag set. From the next page load the on-accept event stops, the on-decline event fires, and the tag stays off. Give visitors a way to withdraw from every page with Reopen Preferences.