Sites & snippet
Snippet behavior
Once the snippet is installed, a Behavior card on the site's Snippet tab lets you fine-tune two things: how long adfit remembers a matched variant as a visitor moves around your site, and how long adfit will briefly hide an area before showing the original content if a personalization hasn't applied yet. This page also covers the resilience safeguards that are always on, how the snippet behaves on single-page apps and on Shopify, and which browsers are supported.
Where to find it
Open the site, go to the Snippet tab, and scroll to the Snippet behavior card. Change a setting, choose Save changes, and it takes effect on the next page load. You don't need to reinstall the snippet.
Variant persistence
When a visitor matches one of your personalizations, adfit shows them the matching variant. Variant persistence controls whether adfit keeps showing that same variant as the visitor moves to other pages on your site, and for how long. There are three modes:
- Session (default): adfit remembers the matched variant until the visitor closes the browser tab. This is the recommended setting for most sites.
- Persistent: adfit remembers the matched variant for 30 days across visits. Best for longer campaigns, where a visitor might come back over several days and should keep seeing the same tailored experience. On Safari this window can be shorter; see Browser support below.
- None: adfit never remembers a variant. Each page load is matched fresh, so personalization only shows on the pages a visitor arrives at directly from the ad (with the matching link).
No cookies involved
adfit remembers the variant in your visitor's browser storage, not in a cookie. It stores only which variant matched, nothing that identifies the visitor.
Anti-flicker safety timeout
To avoid a flash of the original content before a personalization applies, adfit briefly hides the area it's about to change, swaps in the personalized version, and then reveals it, all in a fraction of a second. The Safety reveal timeout is the safety net for the rare case where the personalization is slow to apply or something goes wrong.
- It sets the maximum time adfit will keep that area hidden.
- If the change hasn't applied by then, adfit reveals the original content anyway, so your visitor is never left looking at a blank space. This is a deliberate “fail open” to your original page.
- You can set it between
100and3000milliseconds. The default is800ms, which suits most sites.
Choosing a value
The default of 800 ms is a good balance: long enough for personalization to apply on a normal connection, short enough that a visitor never waits noticeably if something is off. Raise it a little if your site is heavy or slow to load; lower it if you'd rather show your original content sooner in the worst case.
When a new timeout takes effect
Changing the timeout applies right away for returning and cached visitors. The very first (uncached) page load for a new visitor uses the value that's built into the snippet code on your site. If you want your new value to apply on that first load too, reinstall the snippet with the updated embed code from the Snippet tab. For most sites the default is fine and no reinstall is needed.
Built-in resilience
Modern sites keep changing after the page loads: page builders regenerate element IDs on every publish, sliders rotate, and frameworks re-render whole sections. The snippet ships with a set of safeguards that keep your personalizations applied through all of this. They are always on, and there is nothing to configure.
- Self-healing targeting: if your page builder regenerates the internal IDs adfit uses to find an element, adfit adapts to the new ID or falls back to finding the element by its original text, so the change still applies after a re-publish.
- Automatic re-apply: adfit re-checks the page in the first moments after it loads and re-applies a change if your site has re-rendered the element. On pages that keep updating, it watches for further changes for up to about 30 seconds.
- Formatting-safe text changes: when adfit replaces a text, it keeps the element's structure and styling intact, so line breaks and highlighted words survive the change.
- Safety checks: before changing a text, adfit confirms the element still shows the content the change was written for. If your page has changed in the meantime, adfit skips that change instead of overwriting the wrong element.
See what the snippet is doing
For a quick check, open your browser's developer console on your site, run window.__adfitDebug = true, and reload the page: the snippet then logs each step it takes. You can also inspect window.__adfit.diag, a read-only list of anything the snippet skipped or healed on the current page. Both are local to that browser tab: nothing is sent to adfit's servers.
Single-page apps (Framer and similar)
Some platforms, Framer among them, move between pages without a full page reload: clicking a link swaps the content in place, like an app. The snippet handles these in-app navigations on its own, with nothing to configure:
- When a visitor moves to another page, adfit automatically applies the personalizations that match the new page.
- Changes made on the previous page are cleanly removed first, so nothing from one page ever lingers on the next.
- Each real page change counts as a pageview toward your monthly allowance, just like a normal page load. Address changes that stay on the same page (for example jumping to a section) are not counted twice. See Pageview usage.
First visit to a page within a session
The first time a visitor reaches a given page through an in-app navigation, the original content can be visible for a brief moment before the personalization applies. When the visitor comes back to that page later in the same session, the change applies without a flash. The page a visitor lands on first is protected by the anti-flicker mechanism as usual.
Shopify
On Shopify, the snippet goes into your theme's <head> (see Install the snippet) and personalizes your storefront pages. Two Shopify-specific behaviors are built in:
- Collection and product URLs count as one page. Shopify links to the same product both directly (
/products/blue-shirt) and through a collection (/collections/summer/products/blue-shirt). adfit recognizes both as the same product page, so a personalization for that page applies on either URL. - The theme editor is never disturbed. In Shopify's theme editor and theme previews, the snippet is automatically inactive: no personalization is applied and nothing is counted, so you can edit your theme without adfit getting in the way. On your live storefront it runs normally.
What's not covered on Shopify
The snippet personalizes your storefront (theme) pages. Checkout pages and app embeds are not supported: install the snippet in the theme's <head> as described in the install guide.
Shops in several languages
Language prefixes are not merged automatically: adfit treats /de/products/blue-shirt and /products/blue-shirt as different pages. If your shop runs in several languages, set up personalizations for each language you want to cover.
Browser support
The snippet supports the current versions of Chrome, Firefox, Safari and Edge. It relies only on standard browser features, and it always fails open: if a visitor's browser can't run it, that visitor simply sees your original pages.
Safari and the Persistent setting
With Variant persistence set to Persistent, adfit remembers a matched variant for up to 30 days. Safari's tracking protection (Intelligent Tracking Prevention) can clear that memory earlier, typically after about 7 days without a visit. This is how Safari treats browser storage in general, not an adfit error: affected visitors are simply matched fresh on their next visit. The Session setting is not affected.
Related
- Install the snippet: add the snippet to your site before configuring its behavior.
- Verify your connection: confirm the snippet is live and detected.