Setup
- Open Visual editor in your Traffical dashboard.
- Drag the bookmarklet to your browser’s bookmarks bar.
- Navigate to the page you want to test.
- Click the bookmarklet — the editing UI overlays the page.
Creating a visual experiment
- Select an element. Click any element on the page. The editor highlights it and generates a stable CSS selector.
- Edit it. Change text, colors, images, visibility — anything you’d usually do by hand in code. Each edit creates a parameter for the change.
- Define variants. Set the control (original) and treatment values.
- Save. The editor creates the parameter, a DOM binding, and a policy in Traffical. As soon as the bundle refreshes, the experiment is live.
How it works
A visual experiment is just a normal policy on a normal parameter, plus a DOM binding that tells the SDK how to apply the value to the page.| Piece | Where it lives |
|---|---|
Parameter (e.g. visual.hero-heading.textContent) | In the bundle, like any other parameter |
| Policy with control + treatment allocations | In the layer you select |
| DOM binding (selector + property + URL pattern) | Attached to the parameter |
@traffical/js-client, @traffical/react, and @traffical/svelte SDKs include this plugin support — you just need to register it (or use the wrapper SDKs which register it by default).
Anatomy of a DOM binding
| Field | Description |
|---|---|
selector | CSS selector for the target element |
property | What to modify: textContent, innerHTML, src, href, style.* |
urlPattern | Regex of URL paths where the binding applies |
Avoiding flash of original content
Because DOM bindings are applied client-side after the SDK loads, there can be a brief flash of the original content (FOOC) on slow connections. Two mitigations:- Embed
localConfig— bake the bundle into your app’s initial HTML and pass it to the SDK aslocalConfig. The SDK has the bundle before first paint. - Use SSR — server-side resolve and render the treated variant directly. See SSR patterns.
Limitations
- Requires a client SDK installed on the page (
@traffical/js-client,@traffical/react, or@traffical/svelte). - One DOM binding per parameter.
- Complex layout changes are usually better in code than in a binding.
- Bindings are applied after hydration in SSR frameworks — for SSR’d content edits, write the variant in code and read the parameter normally.
Next steps
DevTools
Inspect SDK state and override parameters live.
Web UI experiment pattern
A full walkthrough including DOM bindings.