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.
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. The test takes 6 steps and about 2 minutes in Chrome DevTools. Publish any change to your site first, and replace example.com with your own domain in the filter.
- Close every private window, open a new one, open DevTools with F12, select the Network tab, and tick Preserve log.
- Load your page, click I Decline on the consent banner, and type
events.pushin the Network filter box. A request tocdn.termsfeedtag.comappears with the status 201, which is the consent log receiving the refusal. - Reload the page, then open 2 more pages of your site.
- Type
-domain:*example.com -domain:cdn.termsfeedtag.comin the Network filter box. The list shows only requests to other hosts. - Filter for the host of each analytics and advertising vendor, such as
google-analytics.comorconnect.facebook.net. A request to a vendor host after the decline 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 Privacy 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.
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. 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.
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.
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.
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.
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. 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.
In the Initiator tab of a request to the vendor host, 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.
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 Privacy Consent keeps the refusal on later pages
Privacy Consent stores the refusal in the browser and applies it on every later page, so the scripts stay off without asking again. The record sits in local storage under the key termsfeed_privacy_consent_state, with the date of the answer and each vendor category turned off. www.example.com and example.com each hold their own record, so each asks once.
On each later page, vendors in a refused vendor category skip their on-accept vendor tags and run their on-decline vendor tags. The consent banner stays away for 365 days by default, or until you add, edit, or delete a vendor. Learn how long the answer lasts with Consent Expiry.
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. A saved vendor change reaches visitors within 1 hour. Repeat the test for every analytics and advertising vendor before launch.
- Open the DevTools 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, select Local Storage under Storage, and select your domain. The
termsfeed_privacy_consent_statevalue shows"enabled": falsefor every vendor category exceptessential, and"answeredBy": "visitor".