Cookies and preferences
Forma includes a first-party preference manager in the template's own style. Visitors can allow or decline remembering their Light/Dark/System theme and selected language, and reopen or withdraw the choice from the footer. The default newsletter preview loads no provider script and collects nothing. No analytics, advertising pixel or chat widget is installed.
This manages only the storage listed here. It is not an automatic blocker for services you add, a general consent platform or a legal compliance guarantee. Review your actual site's hosting, services and disclosures before launch.
On this page
Visitor controls
A first visit offers Necessary only, Allow preferences and Manage preferences. Necessary only records a decline. Allow preferences records permission to remember theme and language; it does not install tracking or accept a privacy policy. Manage opens the detailed inventory. The footer entry remains available for changing or withdrawing a choice.
Appearance and language switching work without optional storage. Without permission, a theme change stays in memory for the current page; a later page load starts in System. Language switching navigates to a real language URL, which keeps determining the page language even when storage is declined.
With valid permission, the root / may open the remembered language. Explicit URLs such as /en/ always take priority. This is not browser-language guessing. Review Languages for routes and transient demonstration-state behaviour.
If browser cookie/storage access is blocked, controls remain usable. A choice that could not be saved applies only to the current page. A later load may ask again or find an earlier saved decision because the browser could not replace it. Do not promise every browser will remember the newest choice or remove every stored value.
Default storage inventory
| Item | Storage/value | Purpose and lifetime |
|---|---|---|
forma-cookie-preferences | First-party cookie: v2-allow or v2-deny. | Remembers whether optional theme/language storage is allowed, for 180 days after a successful save. Contains no name, email, account ID or unique visitor identifier. |
forma.theme | Local storage: light, dark or system. | Remembers appearance only with valid permission. Removal is attempted on withdrawal and when a later permission check finds no valid grant. |
forma-language | First-party cookie: one configured language code, initially en or el. | Remembers language for up to 365 days after saving, while valid optional permission remains. The current language URL always wins. |
Both cookies are host-only, with Path=/ and SameSite=Lax; Secure is added on HTTPS. They do not set a parent-domain sharing value. JavaScript reads/updates them, so they are not HttpOnly. Store no private data in them.
Local storage has no built-in expiry. Forma gates its use on the current valid permission cookie rather than treating an old saved theme as permanent consent. Browsers can remove cookies early, and access restrictions can prevent physical cleanup. There is no background expiry timer. Cookies sent to the site's own host and the host's request handling are outside this frontend control.
The template does not persist newsletter addresses or consent records in cookies/local storage. With a real integration enabled, the buyer's configured receiving service handles the submitted details separately.
Withdrawal, expiry and language changes
With a valid allow decision, choosing a theme saves it; the before-paint initializer restores it on later loads. A language choice can be remembered in the separate optional cookie. System continues to follow the browser colour scheme.
Withdrawal stops optional reads/writes for the current page and attempts to remove both the saved theme and language cookie. The current theme can remain usable in memory, and the explicit language URL keeps its language. With normal access and a saved decline, a later load uses System and the root uses the configured default language.
Unknown, malformed, expired or old-version decisions are not permission. A later check asks again and attempts cleanup rather than using those optional values. An unconfigured saved language code is not used to create an arbitrary route. Changing the configured pair should be followed by root/direct-URL and stale-cookie tests.
Settings and translated copy
Shared behaviour/settings live in src/config/cookies.ts. Banner, dialog, inventory and button text live under cookies in both content files. Fixed layout/theme styling is in src/app/globals.css.
Set a real privacy-policy destination in cookieSettings:
enabled: true,
privacyPolicyHref: 'https://www.your-domain.example/privacy/',
A root-relative path such as /privacy/ needs a real page on your host; Forma does not create one. Keep an empty string until a destination exists. The same policy destination is used in both languages; if your policy requires distinct translated pages, implement that deliberately rather than assuming a language prefix is added.
For example, edit these fields inside each dictionary's cookies object:
settingsLabel: 'Privacy preferences',
manageLabel: 'Review preferences',
Expected result: the footer/settings label and banner's manage button use the new language-specific wording. Editing text does not change storage rules, add a privacy page or gate unrelated services. Keep the two inventories accurate for the supplied behaviour.
You may adapt this factual starting text:
We use a first-party cookie to remember whether you allow optional preferences, for up to 180 days. If you allow them, we remember your theme in local storage and your selected language in a separate cookie. Language URLs take priority. You may decline or withdraw using Cookie preferences in the footer; theme and language switching remain available. These controls install no analytics or advertising tracking.
This is not a complete privacy/cookie policy. Add your own identity/contact, hosting/provider details, actual services/data uses and applicable rights. Update names/lifetimes if customized.
Storage names, version and lifetime
The supplied settings are:
storage: {
cookieName: 'forma-cookie-preferences',
version: 2,
maxAgeDays: 180,
themeKey: 'forma.theme',
languageCookieName: 'forma-language',
languageMaxAgeDays: 365,
},
Use simple storage names and stable namespaces for one site. Keep version a positive whole number; version 2 produces v2-allow/v2-deny. Bump it when a material change requires reviewing new optional purposes. An old allow token is not permission for a newly added purpose.
languageCookieName must differ from the permission cookieName. Set languageMaxAgeDays to a whole number from 1 to 400; the language helper rejects values outside that range. The supplied value is 365 days, and optional language storage is still usable only while the current permission remains valid. This is a configuration limit, not a guarantee that a browser keeps a cookie for the full duration.
Durations affect newly saved values; a code change does not rewrite every existing cookie. Preserve {days} in cookies.necessaryDuration and cookies.languageDuration; their inventory text uses the configured lifetimes. Cookie/local-storage names are keys rather than visible brand labels. Renaming a key does not automatically remove the old key; implement and test migration if you change them.
Disabling the manager keeps switching available but disables optional persistence. It does not make a newly added tracking service safe or exempt from its own requirements. Applications on the same origin can see root cookies/local storage; choose namespaces deliberately for any integration.
Upgrade from earlier Forma versions
Version 1.3.0 adds optional language memory and bumps the decision from v1 to v2. A v1 allow decision is not treated as consent for the broader purpose. Visitors are asked again; unpermitted saved appearance/language values are not used and cleanup is attempted.
Version 1.2.0 introduced appearance permission; earlier versions saved a theme directly. A theme alone is not permission. Compare new initialization, language helpers, theme controls, cookie component, layout and footer before reapplying old customizations. Do not copy an old unconditional storage reader over the new helper. Follow Updates.
Added services
Analytics, embeds, chat, real forms, checkout or remote fonts can introduce separate requests/storage. This manager does not detect or block them and does not implement Google Consent Mode. Its preference settings do not include an analytics/marketing category or automatic controls for those services.
Identify each added service's behaviour and implement appropriate loading, permission, withdrawal, inventory and disclosures. Test the service itself. An unchecked theme/language preference is not evidence that an unrelated tracker was blocked. The software licence is a usage licence, not your visitor privacy policy.
Newsletter and third-party forms
The default Get started popup is a local name/email demo-access scenario. With demoAccess.mode: 'preview', it validates locally and shows a labelled demonstration confirmation with a configurable public link. It creates no account or subscription, sends nothing and stores no entered details. Closing resets it. Newsletter preview is a separate email/required-checkbox demonstration; it also collects nothing and loads no provider. Its controls stay disabled without JavaScript. Neither sample checkbox is a recorded marketing grant.
The newsletter and demoAccess settings in src/config/site.ts are separate from cookieSettings. Newsletter placement section shows signup on the page; dialog makes exact #newsletter CTA/navigation links open signup. A kind: 'demo' action still opens demo access independently. The cookie dialog explains the separate email permissions whenever a newsletter is enabled or Kit signup is enabled for demo access, including when newsletter signup is disabled. See Customization.
In newsletter kit mode, the configured third-party embed loads automatically when the section mounts or the signup popup first opens. Set kitLoad: 'interaction' if you need a separate Load signup form step. That control is a provider-loading choice, not marketing permission or a complete third-party cookie-consent mechanism. Configure fields, consent, confirmation and translated provider copy inside the actual Kit Form. Review its network requests and storage, then describe the service in your policy and inventory.
In newsletter kit-native mode, Forma's own email field and required, initially unchecked marketing choice appear immediately. A valid consented submission loads the public Kit handler and sends email plus the configured permission tag. The newsletter has no demo-access behavior. With demoAccess.mode: 'kit', demo access instead has a separate optional, initially unchecked marketing choice: unchecked means no Kit signup request; checked sends name/email and the permission tag through a separate configured Form. The demo continuation works regardless of signup outcome. This remains a public demonstration, not authentication. Account API secrets, a database and a receiving backend are not included.
Native submission may cause Kit verification, privacy or anti-abuse steps. Its received status does not mean the address is confirmed; check the actual confirmation/account status separately. The client must keep approved notice history and appropriate consent evidence. Forma's consentVersion and formId are not automatically sent to Kit. The provider can make further requests or manage its own storage once initialized; do not treat the first-party preference inventory above as the provider's complete inventory.
The newsletter popup keeps its mounted content and unfinished entries on close/reopen during the same page visit. Opening demo access in the shared dialog replaces that newsletter instance; refreshing, navigating away or changing language also starts fresh interface state. Demo access resets on close. Forma does not save entered addresses or consent records to cookies/local storage. Closing or changing purpose cannot cancel an already sent request, unload provider code, remove provider-managed storage or unsubscribe an address.
In endpoint mode, the required unchecked checkbox and notice/version fields are posted to your receiver with the email. That receiver must validate, timestamp, retain/protect the appropriate records and handle withdrawals; Forma supplies no such backend. Keep private API credentials and webhook URLs out of public configuration.
Choosing Allow preferences only permits optional theme/language memory. Withdrawing it does not unsubscribe marketing or revoke a loaded provider. Review the configured services and the applicable policy requirements before publishing; this preference manager is not a general compliance guarantee. Use Email signup and Kit for setup, public-value examples and complete confirmation/unsubscribe tests.
Test your customized preferences
Build production and use a fresh test profile, or clear only this test site's two cookies and forma.theme. Do not clear unrelated data.
- With no decision, confirm the banner and System theme; review the translated inventory and policy link in each language.
- Choose Necessary only, change theme and language, and confirm both work. Reload an explicit language URL: its language should remain, System should return, and the remembered decline should suppress the banner.
- Allow preferences, choose Dark and the secondary language, then reload. Dark should restore; an explicit primary URL must still show primary text. Check root behaviour separately.
- Withdraw from the footer. With normal storage access, confirm both optional values are removed; reload uses System and the root uses default.
- Test expired/old-version permission and a saved language no longer configured. Do not restore an invalid grant or navigate to arbitrary saved paths.
- Test blocked cookie/storage access. Controls should work; the detail dialog explains when a decision applies only to this visit. Saving/removal may be unavailable.
- Check narrow screens, both palettes, keyboard, dialog close/Escape and return focus in both languages.
- Inspect your added services separately; no analytics request should be inferred from these preference controls.
See Appearance, Languages, Launch checklist and Troubleshooting.