---
url: /saas-starter/latest/releases/v0.7.0.md
---
# v0.7.0

Cookie consent for analytics through Google Tag Manager, terms and privacy policy accepted at
sign-up and again when they change, a light and dark theme switch, and a preferences record for
each user.

## Changes to know about

* **`ContentSources` has a `Scripts` list** (`Security/SecurityHeaders.cs`), the origins added to
  `script-src`. Code that creates `ContentSources` itself passes it first.
* **A new `/api/consent/options` endpoint** (every app), which every page asks for. Unit tests of
  the client get its answer from `src/test/server.ts` (analytics off) unless they set their own.
* **The footer** has a theme switch, links to the terms and privacy policy when they're set, and
  a **Cookie settings** button when analytics is on. `Layout` renders the cookie banner.
* **Dark mode can be chosen:** `index.css`'s `dark` variant applies with a `dark` class on
  `<html>`, or when the device is in dark mode and there's no `light` class. `root.tsx` adds a small
  inline script that sets the class before the page paints; the production CSP allows it by its
  hash, like the build's other inline scripts. Pages that follow the device's setting look the
  same as before.
* **A new `/api/legal/options` endpoint** (every app), which every page asks for, like the cookie
  settings (unit tests get "no terms" from `src/test/server.ts`).
* **With accounts and terms set, `POST /api/auth/register` needs `acceptedTermsVersion`.** Without
  `Legal__TermsUrl` or `Legal__PrivacyUrl`, nothing changes.
* **With accounts, a `UserPreferences` record per user** (`Identity/UserPreferences.cs`), stored as
  JSON: a Marten document, or with EF Core a `UserPreferences` table (new migration) with one
  `jsonb` column. It's in the data export as `preferences` and deleted with the account.

Projects created from earlier versions don't change: a template update only affects new projects.

## New

* **Analytics and cookie consent** (every app), off until `Analytics__GoogleTagManagerId` is set:
  * A banner with **Accept all**, **Reject all** and **Choose** (Necessary, Analytics,
    Marketing), and **Cookie settings** in the footer to change the choice later.
  * Tag Manager loads only after the visitor accepts analytics or marketing cookies. Their choice
    is passed on with Consent Mode (`analytics_storage`, `ad_storage`, `ad_user_data`,
    `ad_personalization`).
  * The choice is kept in a `cookie_consent` cookie for six months. Raising
    `Analytics__ConsentVersion` asks everyone again.
  * With accounts, the choice is also saved in the person's preferences
    (`PUT /api/account/consent`), so other devices don't ask again and there's a record of what
    each person agreed to.
  * Tags' origins are allowed in the Content-Security-Policy from configuration:
    `Analytics__ConnectOrigins` (data and pixels) and `Analytics__ScriptOrigins` (scripts, kept
    narrow). Malformed settings stop the app at startup.
  * No vendor code: `docs/analytics.md` covers adding Google Analytics 4, Datadog RUM and
    Rollbar, what the policy blocks (Custom HTML tags, Custom JavaScript variables), and why
    server-side telemetry needs no consent.
* **User preferences** (accounts): one record per user for preferences such as the cookie choice,
  theme or language, read with `GET /api/account/preferences`. A new preference is a new property
  with a default, and needs no migration. See the generated app's `docs/accounts.md#preferences`.
* **Terms and privacy policy** (`Legal__TermsUrl`, `Legal__PrivacyUrl`, `Legal__Version`):
  footer links in every app. With accounts, an "I agree" checkbox at sign-up (checked by the API),
  the accepted version and time saved in the user's preferences, and an "Accept our terms" prompt
  after sign-in for people who signed up with Google or GitHub, were invited, or accepted an older
  version. Links are checked at startup: a path or an http(s) address, never `javascript:`.
* **A theme switch** in the footer: System (the default, following the device), Light or Dark,
  remembered by the browser and, with accounts, saved in the user's preferences so it follows
  them to other devices. No flash of the wrong colours on pre-rendered pages.
* **A Preferences section in Settings** (accounts): the theme, the cookie choice with a
  **Cookie settings** button, and the date the terms were accepted. `ThemeSelect` takes an
  optional `id`, for a visible label.
