- a doubleshift account where you are an owner: only an owner creates API keys;
- a site served through Cloudflare, and a Wrangler project for the Worker (
wrangler.jsoncorwrangler.toml) that you can deploy on that zone; - one public HTML article in the section you start with (
/articles/below), not behind a login or a consent wall.
1
Register your site
In the console, open Sites & fragments and add your bare
domain, host only:
https://your-domain.example/news becomes your-domain.example. See
Sites and fragments.2
Route a section to a fragment
Open the site and create a fragment: a name and a language. It starts active. Under Routing
rules, enter your section’s path,
/articles/, choose prefix, select that fragment, then
Add rule. Pages under /articles/ now resolve to it; no default fragment is needed. See
How delivery works.For step 5 to show a card, at least one active card must be eligible on that fragment. A card with
no fragment selected in its eligibility is eligible everywhere. See Cards.3
Create a delivery key
Open Settings → API keys and create a key. It is shown once: copy it now. Note your account id
(
acc_…), shown in the console: it is the partnerId below. The key stays server-side, in a
Worker secret; see API keys.4
Deploy the Worker with the edge library
Get the library, version 1.1.4 or later, and check its SHA-256:Save In the console, open the site, then the fragment’s Integration page. The routing rules that
target this fragment are selected, and the Worker code there carries their paths in Replace Then deploy:
doubleshift-edge.v1.js next to your Worker entry file and commit it, replacing any older
copy: before 1.1.4, scope is ignored and every page is processed. Then store the key as a Worker
secret, out of the code:scope. Use it
as a new Worker, or add its two lines to a Worker you already run:worker.js — standalone
Inside an existing Worker
<your account id>, and /articles/* with the paths the console shows; outside them, the
Worker leaves the page alone. To cover the whole site, choose Every page of
your-domain.example in the console: the Worker then has no scope. Patterns and limits:
scope.prepareOriginRequest drops If-None-Match and If-Modified-Since from an AI agent’s GET;
every other request is returned untouched. Pass response as fetch() returned it: do not read
its body, and do not compress it yourself. Nothing changes in your templates: the card goes right
before the first <article>, and a page without one is served intact.Give the Worker a route on the hostname you will test, or it never sees your pages: in its Wrangler
configuration, or in the Cloudflare dashboard under the Worker’s Settings → Domains & Routes.
Keep the route broad and let scope pick the paths
(routes and scope).wrangler.jsonc
5
Check humans, agents and scope
Request your article as a human, then as an AI agent, then a page outside Human
scope as an AI agent:0, agent 1, outside 0 is a first presence check: the card reaches agents only, on your
section only. It does not check where the card sits, the brand line or your cache. Run
Verify and troubleshoot before you call the page live; any other result has a known
cause and fix there.scope, several sites, delivery logs, updating the library and watching its records.
