Snippet settings
Settings that control how the ABlyft snippet is built and delivered, and related project settings.
The snippet settings control how your project's snippet is built and delivered to your visitors. You find them in your project under Settings → Snippet.
The page has two columns. On the left are the settings, on the right is the output: your snippet code, its details and the sub-snippets of your environments.
Overview
| Setting | Default | What it does |
|---|---|---|
| Cache expiration (ttl) | 1 minute | How long the snippet may be cached before it is fetched again |
| Anti-flicker mode | Use built-in mode | Prevents visitors from seeing the original page before a variation is applied |
| Minify JavaScript | On | Reduces the size of your custom code |
| Data layer watching | Intercept | How the snippet detects new data layer events |
| Include jQuery | – | Deprecated |
The settings in General Settings are marked as deprecated in the app. Some of them, such as the cache expiration, are managed by ABlyft support and cannot be changed in the form.
Cache expiration (ttl)
Defines for how long the snippet counts as fresh. During this time, a visitor's browser may use its cached copy instead of fetching the snippet again.
| Option | |
|---|---|
| Disable Caching | The snippet is always loaded from the CDN |
| 1 Minute | Recommended, default |
| 2 Minutes | |
| 5 Minutes |
This setting is read-only in the app. If you want to change it, contact ABlyft support.
Changes are not instant
After you publish a change, visitors whose browser has a cached snippet receive the new version only after the cache expiration has passed. With the default of one minute this takes at most about a minute.
While debug mode is on, caching is turned off.
Anti-flicker mode
Flicker means that visitors briefly see the original page before a variation is applied. Choose how you want to prevent it:
- Use built-in mode (default): The snippet hides the page (
visibility: hiddenon the<html>element) right after it has loaded and shows it again as soon as all experiments have been applied, or after 2 seconds at the latest, whichever comes first. - Use your own custom mode: The snippet does not hide the page. Use this if you handle flicker yourself, for example
with your own script in the
<head>.
For the best result, load the snippet synchronously and as early as possible in the <head>, see
Embed the snippet.
Minify JavaScript
When enabled (default), ABlyft minifies the JavaScript that you added to the project: project code, helper code, and the code of experiments and variations. This reduces the file size of your snippet.
Check the effect in Snippet size (before gzip) on the right side of the page.
Data layer watching
Defines how the snippet detects new entries in your data layer. It applies to the
dataLayer Event audience rules and to
watchDataLayerEntry().
| Method | Behavior |
|---|---|
| Intercept (default) | The snippet wraps dataLayer.push and reacts immediately to every new entry |
| Polling | The snippet checks the data layer every 500 ms. Choose this if other scripts replace dataLayer.push |
Include jQuery
The jQuery settings (Include jQuery) are deprecated and are not described further.
Snippet output
The right side of the page shows:
- Implementation (base snippet): the code to place on your site. Click it to copy. See Embed the snippet.
- Project/Snippet ID and Snippet version (the snippet version is managed by ABlyft)
- Snippet revision, Last published and Snippet size (before gzip), see Check the state of your snippet
- Sub-Snippets: one snippet for each environment that has Create a sub-snippet enabled, see Sub-snippets
Publishing
ABlyft publishes your snippet automatically whenever something relevant changes, including the settings on this page. See Publishing. The new version reaches your visitors once the cache expiration has passed.
Related project settings
Further settings with an effect on the snippet are located elsewhere in the project settings.
| Setting | Where | Effect |
|---|---|---|
| Debug mode | Settings → Project Settings | Console output, caching off |
| Use SPA features | Settings → Project Settings → Project Activations Settings | Enables Reset-JS and page triggers for single-page apps, see SPA navigation |
Run only on ablyft.reInit() | Same section | The snippet only starts when your code calls ablyft.reInit() |
| Allow in iFrames | Same section | Lets the snippet run inside iFrames |
| Automatically clean up bucketing | Same section | Removes experiments that were archived within the last 6 months from the visitor's stored bucketing, so that it does not grow too large |
| Publication webhooks | Settings → Project Settings | Notifies your systems after each publication |
| External tracking domains | Settings → Project Settings | Passes the variation assignment to another domain, see below |
| Prerequisites | Settings → Prerequisites | Rules for showing variations and for starting tracking, see Consent manager |
| Data Protection & Compliance | Settings → Data Protection & Compliance | Browser storage, Do Not Track and cookie settings, see Storage & privacy |
Publication webhooks
Publication webhooks let ABlyft notify your systems after every publication, for example to back up or version the snippet, to keep a local copy on your own server, or to send a team notification.
After each publication, ABlyft sends an HTTP POST request (form data) to every URL that you configured. The request
contains these fields:
| Field | Description |
|---|---|
team_id | ID of your team |
project_id | ID of the project |
snippet_revision | Revision number of the published snippet |
snippet_script | The complete JavaScript snippet. Only included if Include JS is enabled |
Your endpoint should answer within 3 seconds. The User-Agent of the request is ABlyft Publication Webhook.
To receive and store the snippet on your own server, see the receiver example in Self-hosting the snippet.
You can trigger the webhooks without changing anything, see Publish manually: Test webhooks.
External tracking domains
If your tracking happens on another domain (not just a subdomain), enter it under External tracking domains.
ABlyft then passes the variation assignment to that domain through a URL parameter. The name of this parameter is
ablyft_set_bucketing by default and can be changed in
Bucketing handover query parameter.
Advanced settings
The fields custom snippet, tracker URL and asset URL (under Data Protection & Compliance → Custom Settings) are read-only and can only be changed by ABlyft support.