Sites & snippet

Snippet behavior

Once the snippet is installed, a Behavior card on the site's Setup page 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 Setup in the sidebar, 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 up to 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 which personalization matched and, for each campaign the visitor matched while adfit was measuring it, the group they were placed in. It can also keep a random value that is used only to pick groups: adfit creates it the first time the visitor matches a campaign running an A/B test with a holdback, and keeps it until the stored version expires. None of it identifies the visitor. See What adfit keeps in a visitor's browser for details.

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 extended the personalization to, adfit shows that page's own version. See Extend 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), up to 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 count from the match that started them, and browsing on does not extend them. A later match with a different personalization does not extend them either, as long as adfit measured one of the matches it still remembers. If it measured none of them, for example when measurement is off for the site (see Turn measurement on or off), the new match starts a new 30 days.

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.
  • If the personalization data arrives shortly after the page is shown, the personalization can still appear a moment after the original, and a much longer text can then move the content below it; see Edit a text change. If it arrives later than that, that page view keeps your original content.
  • 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. With a very small value, the personalization often appears shortly after the page is shown, instead of being in place before the page is visible.

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 Setup page. 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 many visitors in the personalized group entered on this page, how many issues adfit hit when it could not apply a change, and the most common reason. 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 many visitors were first assigned to the personalized group on this page, counted the same way as in your results. Being in that group means adfit set out to show them the personalized version; the next line shows where a change could not be applied. This line and the next count only while measurement is on.
  • Matched but not applied: how many issues adfit hit when it had to skip a change for a matching visitor because the change could not be made safely. Each time adfit skips a change, that counts as one issue, so one pageview can add several (up to 10). On a very busy day, the count can stop at a daily limit.
  • Top reason with the element it concerns (Affected element): 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. When no visitors or issues were counted in the period, for example without traffic or while measurement is off, it says No visitors or issues counted 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

The two rows count different things: Applied counts visitors, Matched but not applied counts issues. Read them side by side, not as a share of each other. Neither row is your pageview usage; see Pageview usage. The card shows totals, the most common reason and the most affected element only, never data about individual visitors. How adfit counts visitors is explained in Reading A/B results.

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 personalization's test link carries the parameter adfit_test=1. The page whose address carries it shows the personalized version, whatever the holdback is, and is left out of your results. It still counts as a pageview when a personalization is applied, like any other delivered page. The parameter only applies to that one page. If you click on to other pages, those are normal visits: they can be counted in your results and can show your original.
  • A visitor who used window.adfit.optOut() is not measured. As long as their objection is saved in their browser, they also see the personalized version. 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. The personalization appears only if its data is there shortly after; otherwise that page change keeps your original content. When the visitor comes back to that page later by an in-app navigation, without reloading the site in between, the change applies without a flash, provided the data arrived in time on the first visit. 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.