Stop a script that keeps sending data after the visitor declines
A script that fires after a click on the "I Decline" button in TermsFeed Privacy Consent runs outside the on-accept vendor tag of its vendor. Privacy Consent never inserts that vendor tag for a visitor who declined. The script comes from a snippet left in the page, a vendor tag that runs for every visitor, an Essential vendor, or another tool that loads it. Each of these sends data from visitors who refused, so trace the request back to its source.
Confirm that the script fires after a decline
Test from a place that sees the consent banner, because a visit with no consent banner runs every vendor until the visitor opts out. Replace google-analytics.com in these steps with the host of your vendor.
- Close every private window, open a new one, open DevTools, and open the Network tab.
- Turn on Preserve log and type
google-analytics.comin the filter. - Load your page and click I Decline on the consent banner.
- Reload the page and read the Network tab. A request to the vendor host after the reload shows the symptom.
- Select that request and open its Initiator tab, which names the script to trace.
Some results look like this symptom and are expected. A Google vendor added from its template loads on every page in the denied state, so its requests keep going with gcs=G100 and do not set a _ga cookie. A cookie the vendor set before the decline stays in the Application tab, because Privacy Consent does not delete cookies a vendor already set. A vendor that ran before a visitor withdrew in the Preferences Center keeps running until the next page load, and the next load holds it back.
Cause 1: The vendor snippet is still in the page
A vendor snippet in the theme, a header field, or a plugin runs for every visitor, even after you add the same code to a vendor. Privacy Consent controls only its vendor tags and replaceable tags. A copy left in the page runs before Privacy Consent knows the answer and after it too.
Open the Elements tab, press Ctrl+F (Cmd+F on a Mac), and search for the vendor host or ID, such as G- for Google Analytics 4. Everything Privacy Consent inserts carries the attribute termsfeed-pc1-vendor-tag-id. A <script element with that code and without the attribute was printed by your page.
Take the page copy out and keep the code in its vendor. Set up the vendor with Add From a Template.
- Remove the snippet from the theme, template, or header field that holds it.
- Turn off any plugin or platform setting that prints the same code, such as a Google Analytics field in the site settings.
- Purge every page cache.
- Repeat the Elements search and confirm that no match lacks the attribute.
Cause 2: The vendor tag sits in an on-load slot
Privacy Consent inserts the on-load permanent and on-load transient vendor tags on every page view for every visitor, whatever the answer. A tracking script in one of those slots fires before the choice and after I Decline. A script under "If declined" fires after I Decline by design.
The vendor form shows which slot holds the code. Open "Vendors" in the TermsFeed app, select "Edit" on the vendor, and open the tab that holds the code. A switch on at "On load (permanent)", "On load (transient)", or "If declined" with tracking code in it explains the request. In a new private window, an element with termsfeed-pc1-vendor-tag-id in the Elements tab before any click tells you the same.
Move the code on a custom vendor, and leave a template vendor as it is. Compare what each slot runs in Trigger Actions.
- Cut the tracking code out of that slot and turn its switch off.
- Turn on "If allowed" in the same tab and paste the code there.
- Select "Save vendor". This edit asks earlier answers again.
- Run the check that ends this page.
Cause 3: The vendor is in the Essential vendor category
Privacy Consent runs every Essential vendor on every page for every visitor, whatever the answer. The Essential vendor category is for services the site does not work without, such as a fraud prevention script every page needs or a login check. An analytics or advertising script filed there fires for visitors who refused.
Open "Vendors" in the TermsFeed app and read the "Type" column for the vendor. A value of "Essential" for a tool the site works without is the fault.
Select "Edit" on the vendor, pick the vendor category that matches its purpose under "What are they used for?", and select "Save vendor". The edit asks earlier answers again, so each visitor then answers for the vendor in its new vendor category. Choose the right one with Vendor Categories.
Cause 4: Another script or a tag manager loads the vendor
A Google Tag Manager container, a plugin, or another vendor tag loads the script on its own, outside the vendor you set up. A container in the page fires its tags for every visitor unless each tag waits for consent. A <script> element inside a replaceable tag runs at page load too, because the browser reads it before Privacy Consent starts.
The Initiator tab shows the chain. Select a request to the vendor host and read it: gtm.js points to Google Tag Manager, and a plugin file points to that plugin. A <script element inside <termsfeed-privacy-consent-tag-script> in the Elements tab points to the replaceable tag.
The fix follows the source of the request. Put the container in a vendor or make each of its tags wait for consent, and turn off the plugin setting that prints the code. Move each tool that another vendor tag loads to its own vendor in the right vendor category. Choose the approach for a container with Use Google Tag Manager, and write the code of a replaceable tag in a form that waits with Replaceable Tags.
How to verify that nothing fires after a decline
Run this test after each fix, once any page cache is purged, in a new private window from a place that sees the consent banner. Run it for every tracking vendor before launch with the check for every tracker.
- Open DevTools, open the Network tab, turn on Preserve log, and type the vendor host in the filter.
- Load your page and confirm that no request to the vendor host appears before you click.
- Click I Decline, then reload the page and open 2 more pages of your site.
- Confirm that the Network tab does not show a request to the vendor host on those page loads.
- Open the Application tab, open Local storage, select
termsfeed_privacy_consent_state, and read"enabled": falsefor the vendor.