CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

adobe/aem-eds-personalization

Section-based personalization for AEM Edge Delivery Services (DA) pages: Section Metadata rows let rules (geo, device, visitor, URL/UTM param, page state, custom audiences), a decision engine (v1 API, OF1), an A/B split or Adobe Target (inline or popup) pick the EDS fragment a section shows, with the authored content as default. Consent first, measurement events per decision, a client runtime plus an optional Cloudflare edge worker, a simulator and Playwright checks.

0.83x
Quality

88%

Does it follow best practices?

Impact

83%

0.83x

1 of 3 eval scenarios. Add 2 more for a full score.

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

README.mdskills/personalize/assets/edge/cloudflare/

AEM Cloudflare worker with personalization

Generated by the personalize skill (aem-eds-personalization plugin). It wraps the official adobe/aem-cloudflare-prod-worker (src/aem-worker.mjs, unchanged, Apache-2.0) in src/index.mjs. The wrapper runs after the origin fetch, so the CDN cache key and the cached HTML stay the same.

What it does:

  • It decides rules, split and api sections using the same modules as the browser runtime. It only decides when the pzn-consent=1 cookie is present (the browser copies it from the consent tool) or when edge-config.js lists an approved exception. Each section ends up in one of three states:

    • applied: the section's content is replaced with the variant (or kept as the default), and the authored content is saved in <template data-pzn-default>.
    • selected: the decision is made, and the browser loads the fragment.
    • left: the section is not marked, and the browser decides it as in client mode.

    Marked sections carry data-pzn-where="edge", data-pzn-status, and the decision: data-pzn-variant, -source, -outcome, -reason, -decision, -cached and -tracking. The browser reads these and sends pzn:decided, pzn:applied and pzn:seen.

  • It leaves some sections to the browser: target sections, and Rule rows that need device:, state: or audience:.

  • It assigns split sections once per browser session, using the pzn-split session cookie.

  • It serves crawlers the authored (default) content.

  • It caches engine answers in a shared cache, keyed only on what the request sends (no visitor id), for the answer's ttl. Personalized HTML is sent with Cache-Control: private, no-cache, plus an x-pzn: edge or x-pzn: deferred header.

  • It runs the server route POST /pzn/decide for browser engine requests. The route:

    • holds the PZN_API_KEY secret and the engine adapters (api.mapRequest/mapResponse; OF1 in adapters/of1.js);
    • rebuilds the v1 request, keeping v1 fields only;
    • fills in the descriptions for the of1 profile;
    • forwards the request only with consent or the approved api exception.
FileOwner
src/aem-worker.mjsAdobe. Re-vendor it to upgrade; do not edit it
src/personalization/{rules,section-spec,outcomes,contract,context,provider-api}.js, src/personalization/sources/split.jsCopied from scripts/personalization/. Re-run install-edge after changing them
src/personalization/{personalize,html}.js, src/personalization/adapters/of1.jsSkill runtime
src/personalization/edge-config.jsSite. Keep fragmentPrefixes, consent and api.engine aligned with scripts/personalization/config.js

Local test

The upstream worker only accepts an https://main--*--*.aem.live origin, so run the dev server over https:

npx wrangler dev --local-protocol https
curl -sk -D - -o /dev/null https://localhost:8787/        # no personalized sections: origin headers, no x-pzn
curl -sk -XPOST https://localhost:8787/pzn/decide -d '{}' # 503 until an engine is set, then 403 without a same-origin Origin

A page's personalized sections only reach the origin once its content is published. Before that, run the edge code over the preview HTML with the skill's simulator. It fakes request.cf, the consent cookie and the user agent:

node <skill>/scripts/simulate.mjs https://main--<repo>--<owner>.aem.page/<page> --edge --consent --country US
node <skill>/scripts/simulate.mjs https://main--<repo>--<owner>.aem.page/<page> --edge --ua Googlebot

Deploy

Deploying is the site owner's decision. See the launch checklist in the skill output. These commands are for the site owner to run:

npx wrangler secret put PZN_API_KEY      # only if a decision engine is used
npx wrangler deploy

skills

personalize

SKILL.md

README.md

tile.json