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 what a visitor sees as they move from page to page, the resilience safeguards that are always on, how to check that your changes are being applied, how A/B groups and measurement work in the browser, 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.

Screenshot coming soon
The Snippet behavior card with the variant-persistence options and the safety-reveal timeout field.

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.

Personalization across pages

A visitor who arrives through one of your ads matches a personalization on the page they land on. From that moment adfit keeps showing the matching version as that visitor moves through your site, not only on the page they arrived at. There is nothing to switch on: this is how a matched personalization behaves for as long as adfit remembers it.

  • On a page you copied the personalization to, adfit shows that page's own version. See Copy to other pages.
  • On a page you did not copy it to, the visitor sees your original content for that page, and the match is not lost on the way. The next page that does have a version shows it again.
  • Coming back to a page the visitor already saw personalized shows that personalized version again.

How long this lasts is decided by Variant persistence above: until the visitor closes the tab (Session), for 30 days (Persistent), or not at all (None). With None, only the page a visitor arrives on from your ad is personalized.

With Persistent, the 30 days start when the visitor first matched. Browsing on does not extend them, so the window always ends 30 days after that first match.

When a visitor starts fresh

If the remembered match runs out, or a visitor arrives without the link from your ad, they see your original pages until they match a personalization again. Nothing is left half applied, and you do not have to clean anything up.

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 100 and 3000 milliseconds. The default is 800 ms, 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 whether your changes are applying

You do not need a browser console for this. Open a personalization and read its Delivery health card: it shows how often adfit applied your changes, how often it matched a visitor but could not apply them, and the reason why. See Delivery health below.

Delivery health

Open a personalization and find the Delivery health card under its results. It answers one question: is adfit actually changing your page for the visitors it matched? Switch the period between Last 7 days and Last 30 days.

  • Applied: how often adfit changed the page as intended.
  • Matched but not applied: how often a visitor matched, but adfit left the page untouched because a change could not be made safely.
  • Top reason with the element it concerns: Element not found on the page, Several elements matched, adfit skipped the change, The original text changed on the page, or Matched, but nothing could be applied.
  • A matching action: Update baseline when your original text changed, otherwise Edit changes.

When everything is fine, the card says No delivery issues in the last 7 days. Without traffic in the period it says No deliveries in this period yet. A personalization with a delivery problem also carries a Not applying badge in the list, so you do not have to open each one to find it.

What the card counts

Counts are per pageview, and nothing about the visitor is stored. The card measures your page and your changes, never the person looking at them.

A/B tests and measurement

When a campaign runs as an A/B test, part of your matching visitors see your original page so adfit has something to compare against. Three things about how the snippet handles that are worth knowing.

The group is decided in the browser

adfit does not ask a server which version a visitor should get. It stores a small random value next to the remembered variant and derives the group from it right there in the browser, which is why there is no extra wait and why the same visitor keeps seeing the same version from page to page. Changing the holdback or restarting an experiment makes adfit decide again, so a visitor can move to the other group at that point.

Both groups count as pageviews

A pageview counts only when adfit decides what a visitor sees: a personalization is applied, or the original is shown to a visitor in an A/B test. All other traffic is free.

A visitor who is shown your original page as part of a running test is part of that: adfit decided what they see and measured them. See Pageview usage for the full rule and Reading A/B results for what happens with the numbers.

Measurement loads separately

The measuring part of the snippet is a second small file. adfit fetches it only when there is something to measure (the site has goals or a running experiment), only after your page has been revealed, and in the same way for both groups. So it never delays your content, and it never gives one group a different loading behavior than the other.

  • A campaign's test link carries the parameter adfit_test=1. Visitors arriving with it always see the personalized version, whatever the holdback is, and they are never counted in your results. They do count as a pageview when a personalization is applied, like any other delivered page.
  • A visitor who used window.adfit.optOut() also always sees the personalized version and is never measured. See Consent and visitor tracking.

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.
  • A real page change counts toward your monthly pageview allowance under the same rule as a normal page load. Counts only when adfit personalizes a page, or shows the original to an A/B test visitor. Address changes that stay on the same page (for example jumping to a section) are never counted twice. See Pageview usage for the full rule.

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.