Find the slot each piece of vendor code belongs in
Each vendor in TermsFeed Privacy Consent has 16 vendor tag slots: 4 vendor tag types (JavaScript, HTML, Style, and Link), each with 4 trigger actions. The vendor tag type decides where the code goes, and the trigger action decides when. Most custom vendors fill a single slot, JavaScript on accept.
The diagram shows every slot with a typical use.
Where each vendor tag type inserts its code
Each type has its own tab on the custom vendor form.
| Vendor tag type | Tab | Where the code goes | What to paste |
|---|---|---|---|
| JavaScript | "JavaScript tags" | <head> |
<script> elements, inline or with src |
| HTML | "HTML content" | Inside <div id="<vendor id>"> on your page |
Markup such as an iframe, a form, or an image |
| Style | "Style tags" | <head> |
<style> elements |
| Link | "Link tags" | <head> |
<link> elements, such as a web font stylesheet |
Privacy Consent reads the code of every vendor tag type as HTML. Code without a <script> element in a JavaScript vendor tag shows as text at the end of <body> and never runs. Saving a vendor with such code fails, and the form shows "Code outside a <script> tag shows on your website as text and never runs." under the field.
JavaScript, Style, and Link vendor tags split the way a browser splits a page. Head elements go to <head>, and the first other element and everything after it go to the end of <body>. A <div> pasted after a <script> in a JavaScript vendor tag therefore lands at the end of <body>.
An HTML vendor tag needs its <div> on your page: without it, Privacy Consent inserts nothing and prints nothing. Copy that <div> from the "Important tags" button on the row of the vendor. Before consent, the <div> of a vendor with on-accept HTML shows the embed placeholder.
Every inserted element carries the attribute termsfeed-pc1-vendor-tag-id. Its value is the vendor ID for an HTML vendor tag, and <vendor id>-javascript, <vendor id>-style, or <vendor id>-link for the others. Replaceable tags have no slot here, and "Has replaceable tags?" is their only switch on the form. Privacy Consent fills a visitor placeholder such as @{TF_PC_V1_VISITOR_COUNTRY} in the code of every slot and every replaceable tag right before it inserts that code. Look up every placeholder in Visitor placeholders in vendor tag code.
The 16 vendor tag slots
Each slot is one tab and one switch, and each switch shows a field for the code. Code that sets cookies or sends visitor data to a vendor belongs only in an on-accept slot.
| Slot | Field on the form | Typical use |
|---|---|---|
| JavaScript, on accept | "JavaScript code to insert if allowed" | Analytics and advertising scripts |
| JavaScript, on decline | "JavaScript code to insert if declined" | Code for decliners that does not set a cookie |
| JavaScript, on load permanent | "JavaScript code to insert on load (permanent)" | Code that needs no consent |
| JavaScript, on load transient | "JavaScript code to insert on load (transient)" | Code that matters only before an answer |
| HTML, on accept | "HTML code to insert if allowed" | An embedded video, map, or form |
| HTML, on decline | "HTML code to insert if declined" | A static image or a link in place of an embed |
| HTML, on load permanent | "HTML code to insert on load (permanent)" | A notice that stays next to the content |
| HTML, on load transient | "HTML code to insert on load (transient)" | A note shown until the visitor answers |
| Style, on accept | "Style code to insert if allowed" | CSS for the widget of the vendor |
| Style, on decline | "Style code to insert if declined" | CSS that hides the empty slot of the widget |
| Style, on load permanent | "Style code to insert on load (permanent)" | CSS that reserves space for the content |
| Style, on load transient | "Style code to insert on load (transient)" | Loading-state CSS |
| Link, on accept | "Link code to insert if allowed" | Web font and widget stylesheets |
| Link, on decline | "Link code to insert if declined" | A local font stylesheet |
| Link, on load permanent | "Link code to insert on load (permanent)" | A stylesheet from your own host |
| Link, on load transient | "Link code to insert on load (transient)" | A stylesheet needed only before an answer |
The trigger actions behave the same way in every tab. Read how each one behaves in Vendor Tag Trigger Actions.
Which slot to use for each kind of code
Match the code the vendor gives you to its vendor tag type, then use on accept unless the code is fallback content or layout.
| Code you have | Slot |
|---|---|
| A script snippet from a vendor | JavaScript, on accept |
| An iframe or embed markup | HTML, on accept, with the vendor <div> on your page |
A <link> to a web font or widget stylesheet |
Link, on accept |
A <style> block for a vendor widget |
Style, on accept |
| Content for visitors who decline | The matching type, on decline |
| CSS that reserves space whatever the answer | Style, on load permanent |
An iframe or image that has to stay in your templates takes a replaceable tag instead of an HTML vendor tag. Compare the 2 methods with How Blocking Works.
How vendor tags behave on repeat visits
Privacy Consent applies the stored answer on every page load, so a returning visitor runs the same vendor tags again on each page. These rows cover a non-essential vendor. An Essential vendor runs on accept in every row and never on decline. Under the opt-out model, a vendor added after the answer follows the stored answer for its vendor category.
| Visit | On accept | On decline | On load permanent | On load transient |
|---|---|---|---|---|
| First visit, consent banner asks | Does not run | Does not run | Runs | Runs and stays |
| First visit, opt-out model | Runs | Does not run | Runs | Runs and stays |
| Right after the answer | Runs at once if accepted | Runs at once if declined | Stays | Removed once loaded |
| Returning visitor with an answer | Runs if accepted | Runs if declined | Runs | Runs, then removed once loaded |
| Withdraws consent in the page view | Stays until the next page load | Does not run until the next page load | Stays | Removed once loaded |
| Accepts after declining in the page view | Runs at once | Leaves the vendor <div>, and stays in <head> until the next page load |
Stays | Removed once loaded |
| Vendor added after the answer | Does not run | Does not run | Runs | Removed once loaded |
Privacy Consent does not delete cookies a vendor already set. An answer lasts 365 days (12 months) by default. Look up that period with Consent Expiry.
How editing vendor tags reaches a live consent banner
Saving an edited vendor tag reaches a visitor with no cached copy at the next page load. A browser that loaded the settings in the last hour gets it within 1 hour. Pages already open keep the old code until they reload. Check the new code in a new private window: select the Elements tab in Chrome DevTools and search for termsfeed-pc1-vendor-tag-id=.
An edit that changes vendor tag code asks every visitor with an older answer again, and their stored choices run the new code until they answer. Plan the effect with Force Every Visitor to Consent Again.