Dynamic Headlines for Your Website: 3 Ways to Build Them
2026-09-13
A dynamic headline is a headline that changes based on who's looking at it. Same page, same URL — different words for the Google visitor, the LinkedIn visitor, and the person coming back for the third time. Three ways to build this:
Approach 1: Server-side rendering swap
The server decides which headline to render before the HTML reaches the browser. Minimal Express example: a variants map keyed by utm_campaign with a default fallback; server reads req.query.utm_campaign or a cookie, renders the headline into the template. Pros: no flicker, no layout shift, fast. Cons: caching gets complicated (vary cache by campaign or bypass it — where most attempts die); you own the variant map (every new campaign = code change + deploy + QA); doesn't fit static/JAMstack without edge functions; limited signals (server sees URL, headers, cookies only). Best for: server-rendered apps with modest campaign counts and someone to own the variant map and caching.
Approach 2: Client-side JavaScript swap
Page renders with a default headline, then a script swaps it based on the URL: read utm_campaign via URLSearchParams, look up a variants object, set textContent, keep the original as fallback (never blank). To avoid flicker, hide the headline with visibility:hidden (keeps layout space — no shift) until the swap decision runs, then reveal. Pros: works everywhere (any HTML, any host, any CMS), free, simple. Cons: flicker-or-delay tradeoff; you own everything (variant map, cookie logic, QA, edge cases — a typo'd UTM falls back to default only if you built the fallback); URL-only signals out of the box; it rots (variant maps in code go stale — the real cost of DIY is maintenance, not building). Best for: one or two campaigns, a technical team, acceptable brief flicker.
Approach 3: The snippet approach (what Prept does)
One snippet before
