FAQTracking Snippet & Installation

Tracking Snippet & Installation

How the snippet works and how to install it — 9 questions.

The tracking snippet is a small JavaScript file — under 2KB — that you add to your website's <head> section once. It handles all of the following automatically:

  • Identifying the visitor with a persistent anonymous ID
  • Calling the Iteratist servers to determine which variant to serve
  • Applying variant changes to the page before it becomes visible
  • Recording the exposure (visit) against the assigned variant
  • Detecting when a visitor reaches the conversion goal URL and recording the conversion

The snippet is designed to have minimal impact on page performance. It loads asynchronously, meaning it doesn't block the browser from rendering the rest of your page. Variant changes are applied within milliseconds — typically under 50ms from load — so visitors never see a flash of the original page before the variant is applied. The snippet itself is under 2KB, which is negligible compared to most images or JavaScript libraries on a typical web page.

Paste the snippet inside the <head> tag of every page on your website that you want to run experiments on. The earlier in the head it appears, the faster variant changes will be applied. Ideally place it as the first or second script in your <head>, before other analytics or marketing scripts.

If you're using a CMS or site builder, most platforms have a "Custom code in head" or "Header scripts" setting where you can paste it once and have it apply globally.

You can load the Iteratist snippet via Google Tag Manager using a Custom HTML tag. However, there is a trade-off: GTM loads scripts slightly later in the page lifecycle than a snippet placed directly in the <head>. This can occasionally cause a brief flash of the original page before the variant is applied, particularly on slower connections. For best results, we recommend placing the snippet directly in the HTML head rather than loading it through GTM.

Iteratist generates a random anonymous visitor ID when it first sees a new browser on your site and stores it in the browser's localStorage. This ID has no connection to the visitor's personal identity — it's simply a random string used to ensure the same person always sees the same variant. If a visitor clears their browser storage or uses a different device, they will be assigned a fresh ID and may see a different variant on their next visit.

If the snippet is blocked, the visitor simply sees the default (control) version of your page as if no experiment were running. Their visit is not recorded in Iteratist's data. This is a graceful degradation — blocked visitors don't see a broken page, they just aren't included in the experiment. The proportion of visitors using ad blockers is typically consistent across all variants, so it doesn't introduce bias into your results.

Iteratist's snippet fires on page load and applies DOM changes at that point. For traditional multi-page websites this works perfectly. For single-page applications (React, Vue, Angular, Next.js) where page content changes without a full page reload, the snippet may not re-apply changes on navigation. SPA support with client-side routing hooks is on the product roadmap. For now, SPAs work best if the experiment is on the initial landing page that loads on the first request.

When a visitor lands on your page, their visitor ID is recorded alongside the variant they were shown. The snippet continues monitoring the visitor's navigation. When they reach the goal URL you configured (your thank-you page, order confirmation, or other conversion destination), the snippet fires a conversion event to Iteratist's servers, which records it against the correct variant. No additional conversion pixel or tag is needed — the snippet handles it automatically.

Yes — as long as the page is accessible to the actual visitors you want to test (whether they're authenticated users or not), the snippet will work. The Iteratist snippet doesn't require the page to be publicly accessible to the internet; it only needs to run in the visitor's browser when they view the page. The visual editor, however, requires the page to be loadable in an iframe on the Iteratist domain, which means it may not be able to preview pages behind authentication systems with strict frame restrictions.

Previous topic ‹ AI Features

Ready to run your first test?

Set up in minutes — no developer or credit card required.

Get started free