Cookie consent on a landing page

A landing page often shows a map, a video or a booking widget, and counts its visitors with Google Analytics. Each of these loads from another server. Silvertrail holds every one of them back until the visitor agrees, asks through its banner, and checks the page before it goes live. This page walks through a new landing page from the first line, by hand or with an agent.

On the page What Silvertrail does
Google Analytics, Tag Manager, Google Ads, Meta Pixel, LinkedIn Insight A preset prints the official tag once you give it the ID, and only after a yes.
A YouTube or Vimeo video, a Google map The embed presets are on from the start. The iframe waits behind a placeholder that asks for this one service.
A booking, chat or newsletter widget Register it as a service with the hosts it loads from, and gate its script.
Fonts from Google Fonts or another font service Fonts cannot wait for consent. Serve them from the site itself, and the check reports any that still load from elsewhere.
Images, styles and scripts on the site's own server Nothing. They load as usual.

Set it up

HTML

  1. Run npx @mawiswiss/silvertrail init in the site's folder. It copies the script and the stylesheet to silvertrail/.

  2. Put the head block first in every page's <head>, with the page's services in the config:

    <link rel="stylesheet" href="/silvertrail/silvertrail.css">
    <script type="application/json" id="silvertrail-config">
    { "services": { "google-analytics": { "tag_id": "G-XXXXXXXXXX" } }, "privacy": "/privacy.html" }
    </script>
    <script src="/silvertrail/silvertrail.js"></script>
    
  3. Copy the banner before </body> and put each map or video into its placeholder. npx @mawiswiss/silvertrail markup banner and npx @mawiswiss/silvertrail markup embeds print the markup, and The markup on an HTML page explains it.

  4. Link #silvertrail in the footer, so visitors can change their choice, as Reopen the preferences shows.

  5. Run npx @mawiswiss/silvertrail check until it reports no issue.

WordPress

  1. Install the plugin with wp plugin install silvertrail --activate, or from Plugins › Add New. Maps and videos in the page's content wait behind a placeholder from then on.
  2. Turn on the tracker presets with their IDs, under Settings › Silvertrail or in code, as Presets shows.
  3. Add the reopen link to the footer menu, as Reopen the preferences shows.
  4. Run wp silvertrail validate until it reports no problem, and open the Leak check under Settings › Silvertrail › Tools.

Kirby

  1. Install the plugin with composer require mawiswiss/silvertrail-kirby.
  2. Turn on the tracker presets with their IDs under mawiswiss.silvertrail in site/config/config.php, as Presets shows. Maps and videos in the page wait behind a placeholder from the start.
  3. Put <?php snippet('silvertrail/reopen') ?> in the footer, as Reopen the preferences shows.
  4. Run kirby silvertrail:validate until it reports no problem, and open the Leak check at /silvertrail/leak-check.

With an agent

An agent with the Silvertrail skill sets all of this up whenever it builds a page that loads an outside service, even when the request does not name Silvertrail. Install the skill once. In Claude Code, it comes as a plugin:

/plugin install silvertrail --marketplace mawiswiss/silvertrail

Other agents that read skills install it with npx skills add mawiswiss/silvertrail. Then describe the page you want:

Build a landing page for my bakery in Zurich. It shows our shop on Google
Maps and counts visitors with Google Analytics, ID G-XXXXXXXXXX.

The agent asks only what the site cannot tell it, such as who runs the site, does every technical step itself and runs the check. An agent without the skill gets the same result from Agents and the Markdown copy of these pages.

Before it goes live

  • The check reports no issue, and a first visit loads nothing from another server until the visitor agrees.
  • The privacy page and, where the site needs one, the imprint are published, and the banner and the footer link them. Privacy and imprint pages covers what goes on them.
  • Someone who knows the law where the site operates has read the privacy page. Silvertrail and its agents draft it and give no legal advice.