Get a vendor script running after visitors click "I Agree"
A click on the "I Agree" button leaves a TermsFeed Privacy Consent vendor script silent when the vendor is not served, its code is misplaced, or the page refuses it. Privacy Consent inserts the on-accept vendor tag of each accepted vendor at once, on the same page and with no reload. A script that does not start after the click has one of the causes here, and a site with no consent banner starts with Consent Banner Missing.
Confirm that the vendor script stays silent
Test in a new private window, because a stored answer changes what the page does. Replace googletagmanager.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
googletagmanager.comin the filter. - Load your page and click I Agree on the consent banner.
- Read the Network tab. No request to the vendor host after the click shows the symptom.
- Open the Elements tab, press Ctrl+F (Cmd+F on a Mac), and search for
termsfeed-pc1-vendor-tag-id=".
No match for your vendor points to the causes from 1 to 3 and to Cause 7. A match with no request points to Cause 4, and a replaceable tag or a vendor div that stays empty points to Cause 5 or Cause 6.
Cause 1: The vendor is inactive
Privacy Consent leaves inactive vendors out of the settings it serves, so an inactive vendor runs nothing. The "Vendors" page of the TermsFeed app lists it under the "Inactive" group, and it does not appear in the Preferences Center either.
Check the app and the settings document. On the "Vendors" page, find which group holds the vendor. In the Network tab, type plugins-api-w in the filter, select the settings.json request, and search its Response tab for the vendor name. No match means visitors do not receive the vendor.
Turn the vendor on and test it.
- Select "Edit" on the vendor and select "Activate vendor".
- Open a new private window, because a browser keeps the settings it downloaded for up to 1 hour.
- Search the Response tab of
settings.jsonagain and confirm that the vendor name appears.
A visitor who answered earlier has not answered for that vendor, so it stays off until the next answer. Ask those visitors again with Force Re-Consent.
Cause 2: The vendor tag is in the wrong slot
Privacy Consent runs only the "If allowed" slot after a click on the "I Agree" button, so code under another switch does not run at that moment. Each tab of the vendor form holds 4 switches: "If allowed", "If declined", "On load (permanent)", and "On load (transient)". A slot with its switch off stores nothing, so the code runs only from a switch that is on.
Open the vendor form and the tab that holds the code. Code under a switch other than "If allowed", or "If allowed" turned off, explains the silence.
Move the code to the slot that runs on accept. Compare what each slot does in Trigger Actions.
- Turn on "If allowed" in the right tab and paste the code there.
- Clear the slot the code came from and turn its switch off.
- Select "Save vendor" and run the check that ends this page.
Cause 3: The code sits under the wrong vendor tag type
Privacy Consent inserts each vendor tag type in its own place, so code under the wrong tab never runs or never reaches the page. The "JavaScript tags", "Style tags", and "Link tags" tabs read their code as HTML. Plain code with no <script> element is text to the page, so it lands at the end of <body> and does not run. The "HTML content" tab inserts only into a <div> whose id equals the vendor ID, and a page without that element gets nothing.
Read the slot in the vendor form, then the page. A JavaScript slot that starts with plain code, such as gtag('config', ...), is the fault, and it often shows as stray text at the bottom of the page. The vendor form refuses to save such code, so the fault sits in a vendor last saved before the form checked it. For the "HTML content" tab, search the Elements tab for id="termsfeed- and look for the <div> with your vendor ID.
Put each kind of code under its own tab. Compare where each vendor tag type goes in the Vendor Tag Matrix.
- Wrap script code in its
<script>element in the "JavaScript tags" tab. - Move markup such as a
<div>into the "HTML content" tab. - Copy the
<div>from "Important tags" on the "Vendors" page and paste it where the content belongs on your page. - Reload in a new private window, click I Agree, and look for the vendor in the Elements tab.
Cause 4: A Content Security Policy blocks the inserted script
A Content Security Policy (CSP) that does not list the vendor host blocks the vendor script, because Privacy Consent does not add a nonce to a vendor tag. A Content Security Policy is the header or meta tag that lists the hosts a page loads code from. The vendor tag reaches the page, and the browser refuses to run it.
Read the Console tab after the click. A message that starts "Refused to load the script" and names the vendor host points to the policy, and the Network tab filtered by that host shows (blocked:csp).
Widen the policy for that vendor. Copy the allowances Privacy Consent needs from Content Security Policy.
- Add the vendor host to
script-src, such ashttps://www.googletagmanager.com. - Add the hosts the vendor sends data to in
connect-srcandimg-src, as the vendor documents them. - Allow the inline part of the vendor tag, because a nonce-only policy does not cover it.
- Reload, click I Agree, and confirm that the Console message is gone.
Cause 5: A replaceable tag has no vendor switch
A replaceable tag turns into its real element only while the vendor has "Has replaceable tags?" on, and it stays empty without that switch. A replaceable tag is an element such as <termsfeed-privacy-consent-tag-iframe> that stands in for an iframe, image, script, style, or link until consent. Without the switch, Privacy Consent does not show an embed placeholder or print a message. A replaceable tag added to the page after Privacy Consent started waits for the next page load in the same way.
Find the replaceable tag in the Elements tab and look at the element right after it. No div that holds an element with the class termsfeed-pc1-ec-wrapper means Privacy Consent did not take up the tag.
Turn the switch on and test.
- Select "Edit" on the vendor and open the "Replaceable tags" tab.
- Turn on "Has replaceable tags?" and select "Save vendor".
- Reload in a new private window and confirm that the wrapper appears after the tag.
A disabled switch means this consent banner does not offer replaceable tags, and the notice beside it says so. Set up each element with Replaceable Tags, and fix a placeholder that stays in place with Embed Never Loads.
Cause 6: The vendor ID does not match
Privacy Consent finds a replaceable tag and a vendor div by the vendor ID, so a wrong character leaves the element untouched. A vendor ID starts with termsfeed-, such as termsfeed-1a2b3c4d-5e6f. Each vendor has its own, so an ID copied from another vendor or another consent banner matches nothing. The id of a div has to match exactly, while a replaceable tag ignores case.
Compare 2 values. On the "Vendors" page, select "Important tags" on the vendor row and read the ID in the markup it shows. In the Elements tab, read data-termsfeed-pc1-vendor-id on the replaceable tag or the id of the <div>.
Paste the ID from "Important tags" into the attribute or id on your page, publish the page, and purge any page cache. Reload in a new private window, click I Agree, and confirm that the element loads.
Cause 7: An on-load script holds every accept tag
Privacy Consent inserts accept tags only after all on-load tags finished, and it never times out a script. An on-load <script src> without async whose server does not answer holds the accept and decline tags of every vendor until the browser gives up on it. A script that fails with an error status releases them at once.
Look for the waiting request in the Network tab. Clear the filter, reload, and find a request with the status (pending), then read its Initiator tab to see which script started it.
Add async to that <script> element in its on-load slot, or remove the tag, and select "Save vendor". Reload in a new private window and confirm that the accept tags run after I Agree.
How to verify that the vendor script runs after "I Agree"
Run this test after each fix, once you saved the vendor and purged any page cache.
- Close every private window, open a new one, open DevTools, and 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 Agree on the consent banner and confirm that a request to the vendor host appears right after the click, with a status such as 200.
- Open the Elements tab, search for
termsfeed-pc1-vendor-tag-id=", and confirm that a match names your vendor ID.
Reload once more, and the vendor request appears as soon as the page loads, because the stored answer now applies. Walk through a complete setup with Add a Custom Vendor.