Load Cookie Consent from TermsFeed instead of a copy on your server
TermsFeed does not recommend self-hosting TermsFeed Free Cookie Consent, because a copy on your server does not get the updates and bug fixes TermsFeed ships. Keep the script tag the TermsFeed generator writes, which loads Cookie Consent from www.termsfeed.com. Replace a text of the consent banner without a copy with Change the Cookie Banner Text With Free Cookie Consent.
What a self-hosted copy of Cookie Consent misses
TermsFeed maintains the 4.2.0 build at the hosted address, and a self-hosted copy stays as it was on the day you downloaded it. TermsFeed ships each fix to 4.2.0 in place, under the same version number. Some fixes change behavior that matters for consent, such as the order of the user_consent_saved callback.
| What changes | Script hosted by TermsFeed | Copy on your server |
|---|---|---|
| Bug fixes and updates to 4.2.0 | Reach your pages on the next page load | Do not reach your pages until you download the file again |
| Your work after each fix | None | Download the file again and replace your copy |
Requests to www.termsfeed.com |
The loader, the script, and a ping with the page hostname | None |
How to self-host Cookie Consent
Self-hosting takes 4 steps and about 15 minutes. You need the Cookie Consent block from the TermsFeed generator and a way to upload files to your web server.
- Download
https://www.termsfeed.com/public/cookie-consent/4.2.0/cookie-consent-code.jsand save it under the namecookie-consent.js. - Upload the file to a folder your site serves, such as
/js/cookie-consent.js. Serve it astext/javascriptwith UTF-8, because the file holds the translations as UTF-8 text. - Replace the TermsFeed address in the first
<script>tag of the block with the address of your file. Keepcharset="UTF-8", and do not addasync, so the file runs beforerun(). - Publish the change and clear your page cache. Close every private window, open a new one, filter the Network tab for
termsfeed, load your site, and confirm that no request appears.
A Content Security Policy then needs your own host in script-src instead of https://www.termsfeed.com. Update the policy with Content Security Policy (CSP).