Installing the script
One paste into your <head>: an inline bootstrap plus two async bundles, one that serves variants and one that captures behavior. What each part does, where it has to sit, and how to prove it landed.
One paste, into the <head> of every page you want Optimeleon on. Copy it from Setup → Script in the app. It is stamped with your project's token, so do not retype it from here.
<!-- Optimeleon. Paste once, inside <head>. Do not modify. -->
<script>/* Optimeleon bootstrap: call queue + anti-flicker guard */</script>
<script async crossorigin="anonymous" src="https://edge.optimeleon.com/b/YOUR_TOKEN.js"></script>
<script async crossorigin="anonymous" src="https://edge.optimeleon.com/c/YOUR_TOKEN.js"></script>What each part is for
| Tag | Role | If it fails |
|---|---|---|
| Inline script | Installs the call queue so nothing you call early is lost, and raises the anti-flicker guard before any body content paints. | The page never hides, so no flicker protection. The page is visible, which is the safe direction. |
/b/…js | The experimentation bundle. Fetches the variant decision and applies it, then reveals the page. | The page reveals itself and visitors see your original. |
/c/…js | The tracking bundle. Captures pageviews, behavior and your conversion events. | No measurement. Variants still serve. |
crossorigin="anonymous", and on some sites the tags carry extra attributes as well. They are there for serving performance and for surviving speed plugins. Copy the snippet as given and do not tidy the tags up.Put it as high in the head as you can
Ideally the first thing in <head>, above your tag manager, your analytics, and your fonts. The anti-flicker guard can only protect what has not painted yet, so every tag ahead of it is a tag that can delay it.
Optimeleon checks this for you and raises a non-blocking warning if the snippet is sitting lower than it should. The install verifies either way. It is worth fixing, not worth stopping for.
Do not modify, minify, defer or move it
The four ways installs actually break, in the order we see them:
- A speed plugin re-hosts the bundles from your own domain. The page looks fine and the tests keep running, but your events are being posted to your web server, where they vanish. A copied bundle also freezes your campaign configuration at the moment the copy was made, so a variant you publish later silently never goes live.
- “Delay JavaScript execution” holds the tags until first interaction. Visitors who never scroll or tap are never counted, and variants apply late and visibly.
- The tags are moved into a tag manager. Same problem, different cause. See Google Tag Manager.
- A Content Security Policy blocks them. Covered below.
If your site runs WP Rocket, LiteSpeed, Autoptimize, Perfmatters, SiteGround Optimizer, W3 Total Cache, NitroPack or Cloudflare Rocket Loader, read WordPress & performance plugins before you go live. The snippet carries the opt-out attributes those plugins honour, but several publish no attribute at all and need an explicit exclusion.
Allow Optimeleon in your Content Security Policy
If your site sends a CSP header, the edge origin has to be allowed for scripts and for the connections the bundles make.
script-src 'self' https://edge.optimeleon.com;
connect-src 'self' https://edge.optimeleon.com;'unsafe-inline' for scripts, add a nonce or hash for it. Note that a nonce has to be applied to the tag as you paste it, so this is a change to make in the template, not in the snippet.Verify
The script step hands you a test link that opens your own site with a verification flag on it. Load it once and the step turns green, with no waiting for organic traffic.
To check by hand instead:
- Open your page source and confirm both tags load from
https://edge.optimeleon.com/…and not from your own domain. - Confirm they are plain
<script async src="…">tags, nottype="text/rocketlazyloadscript"ordata-rocket-src="…". - Load the page, accept your cookie banner, and watch DevTools → Network for a
POST https://edge.optimeleon.com/e/…returning 202.
The install health panel
Below the snippet, Optimeleon shows what it can see about your live install: whether the bundles are being served from us or from a copy, whether execution is being blocked or delayed, whether the anti-flicker guard is intact, and where in the head the paste is sitting.
Each finding names the thing to fix. A green pageview signal with an amber finding beside it means “this works, and it is still worth fixing”. The checklist will not show you a clean tick over a panel that is asking for work.
The AI Installation Kit
If you are handing the install to a developer or an agency, open Custom instructions on the script step. Optimeleon detects your stack and generates install instructions written for it, including the exclusions your specific speed plugin needs, which you can send on as a self-contained brief.
