Find the Cookie Consent version in the script address, such as 4.2.0 in https://www.termsfeed.com/public/cookie-consent/4.2.0/cookie-consent.js. 4.2.0 is the version the TermsFeed generator writes today. A site on 4.0.0 or 4.1.0 keeps that version until someone changes the address.

Each version has its own address, and the loader at that address loads the script of the same version. A 4.1.0 or 4.0.0 site loads the same address with 4.1.0 or 4.0.0 in place of 4.2.0.

To check a live page, open Chrome DevTools, select the Network tab, type cookie-consent in the filter box, and reload. The requests show the version in their path. A self-hosted copy does not carry a version in its address, so search your copy: user_consent_saved_on_page_load appears only in 4.2.0, initial-data-cookie-consent in 4.1.0 and 4.2.0, and initial-cookie-consent in 4.0.0.

All 3 versions write the same 3 cookies with the same names and the same JSON object format, so answers saved by 4.0.0 or 4.1.0 stay valid in 4.2.0.

Area Site runs now What changes in 4.2.0
Tag attribute 4.0.0 4.0.0 reads cookie-consent="<category>", so a script tagged for 4.0.0 never runs under the later versions. 4.1.0 and 4.2.0 read data-cookie-consent="<category>".
New options 4.0.0 or 4.1.0 4.2.0 reads 5 options that 4.0.0 ignores, 2 of them new in 4.2.0: notice_banner_purposes_levels and user_consent_saved_on_page_load. 4.1.0 reads the other 3: cookie_duration, callbacks, and callbacks_force.
On/off options 4.0.0 or 4.1.0 Before 4.2.0, any truthy value means on, "false" included, and debug and demo turn on only with the string "true". 4.2.0 takes true or "true" in any case as on, and every other value as off.
language 4.0.0 or 4.1.0 Before 4.2.0, the option alone chooses the language, default en. Without the option, 4.2.0 follows the browser languages, then English.
palette, notice_banner_type 4.0.0 or 4.1.0 Before 4.2.0, a value in another case or an unknown value gives dark or simple. 4.2.0 reads any case, and an unknown value gives light or headline, with a warning.
page_load_consent_levels 4.0.0 or 4.1.0 Before 4.2.0, the option is a case-sensitive array only, and a single string does not release any optional category. 4.2.0 takes an array or one category as a string, in any case.
Legal URLs 4.0.0 or 4.1.0 4.2.0 checks each URL on its own and accepts only absolute http: or https: URLs. Before 4.2.0, the consent banner shows neither link when both are set and either fails.
Cookie lifetime 4.0.0 or 4.1.0 4.0.0 ignores cookie_duration and sets 62 days for cookie_consent_level and cookie_consent_user_accepted, and 3,650 days (10 years) for the token. Cookies written by 4.0.0 keep their 62-day expiry until the visitor answers again. 4.2.0 reads cookie_duration, default 365 days, and an invalid value, which gave a session cookie in 4.1.0, gives 365 days with a warning.
user_consent_saved 4.1.0 The callback receives (details, reason) and runs before any tagged script is released. With user_consent_saved_on_page_load, it runs on page loads of a visitor who answered as well.
Other callbacks 4.1.0 notice_banner_loaded runs after run() returns. change_my_preferences_button_clicked runs for the consent banner button only. scripts_specific_loaded runs at most once per category, once its external scripts without async load, fail, or time out. scripts_all_loaded runs whenever every category in use is released, after scripts_specific_loaded, not only after "I agree". Errors reach the console.
Tagged script release 4.0.0 or 4.1.0 External scripts run in page order: an external script without async holds its category until it loads, fails, or 10 seconds pass.
A second run() 4.0.0 or 4.1.0 A second run() call keeps the first instance, where earlier versions add a second consent banner.
Consent banner text 4.0.0 or 4.1.0 The consent banner shows a sentence that lists the purposes of the categories in use.

Upgrading takes 7 steps and about 15 minutes. Make the change on a test copy of your site first.

  1. Replace 4.0.0 or 4.1.0 with 4.2.0 in the src of the loader tag, on every page or template that loads it.
  2. On a 4.0.0 site, replace every cookie-consent=" attribute on tagged scripts with data-cookie-consent=". Search for cookie-consent=" with its leading space, so a find-and-replace skips attributes that already read data-cookie-consent=".
  3. Set each on/off option to true or false, and set language to the language every visitor starts in.
  4. On a site that uses Google Consent Mode, keep the denied Consent Mode defaults as the first script in <head>, after only the charset meta. The defaults sit above the Google tags, the Google Tag Manager container, and the Cookie Consent block. Send Google Consent Mode updates from user_consent_saved with user_consent_saved_on_page_load: true, and grant other vendor signals from scripts_specific_loaded with callbacks_force: true. Filter the records you write in user_consent_saved on reason === 'choice'.
  5. Replace unprefixed ids, such as cc-nb-title (#cc-nb-title in CSS), in your CSS and scripts with the prefixed ids of 4.2.0, such as termsfeed-com---nb-title. The 4.2.0 ids and classes all carry the termsfeed-com--- or cc- prefix, except is-active and is-inactive. Check every 4.2.0 id and class in Free Cookie Consent DOM and CSS Reference.
  6. Under a nonce-based Content Security Policy, write the page nonce on the loader tag, and allow that nonce in style-src. Check the other 4.2.0 rules in Content Security Policy (CSP).
  7. Publish the changes and clear your page cache. In a new private window, open the Network tab, load your site, filter for cookie-consent, and confirm the requests carry 4.2.0. Turn on debug: true, publish, clear the page cache, reload, and confirm that no Console line contains Invalid. Fix each option a warning names, then remove debug.

A self-hosted copy changes only when you replace the file, so an upgrade means downloading the 4.2.0 file and repeating the upgrade checks. Download https://www.termsfeed.com/public/cookie-consent/4.2.0/cookie-consent-code.js, replace your copy, and apply any text changes you made to the old copy again. Follow the download and serving steps in Self-Host Free Cookie Consent on Your Server.