Integrate ABlyftDebugging

Common issues

Typical technical problems with the ABlyft snippet and how to solve them.

Find your symptom, check the cause, apply the fix. Turn on debug mode first, because the console output usually names the reason directly.

The snippet does not start

The snippet stops silently in these situations. Some print a message in the console, even without debug mode.

SituationConsole messageFix
A second snippet is on the pageABlyft aborting - first snippet already initializedInclude the snippet only once per page, also when you use a tag manager
The page is inside an iFrameABlyft aborting - running in IframeEnable Allow in iFrames in the project settings if this is intended
The visitor opted outnoneOpen the page with ?ablyft_opt_out=false, see Opt out
Do Not Track is enabled in the browser and the project respects itABlyft # stops because client's doNotTrack is enabledTurn Do Not Track off in the browser for testing, or review the setting under Settings → Data Protection & Compliance
The browser is rated as a bot (user agent contains for example bot, google, crawler, spider)Rated as Bot- Exiting (debug mode)Use a normal browser. Automated test tools with such a user agent are ignored
The general prerequisite rules are not metGeneral Prerequisite Rules NOT met (debug mode)Check the rules in Settings → Prerequisites
Run only on ablyft.reInit() is enablednoneCall ablyft.reInit() when your application is ready
The Visual Editor session is activeVisual Editor Mode activated (debug mode)Close the editor tab or clear the session storage

The snippet is outdated

You published a change, but the page still behaves as before.

  1. Wait for the Publishing … indicator in the top bar to disappear.
  2. Allow for the cache time. See Snippet settings.
  3. Compare ablyft.get('data').revision with Snippet revision in Settings → Snippet. If they differ, the browser still uses an old copy. Reload the page with a hard refresh.
  4. Check that you load the right file: an environment with a sub-snippet has its own file, such as …/s/12345678-staging.js.
  5. If your own server or a CDN sits in front of the snippet, make sure it does not cache the file for longer.

While debug mode is on, snippet caching is turned off, which is helpful while you test.

Flicker

Flicker means visitors briefly see the original page before the variation appears.

  • Load the snippet synchronously and as early as possible in the <head>, before large scripts and stylesheets. Avoid async for the snippet. See Embed the snippet.
  • Keep the Anti-flicker mode at Use built-in mode (Settings → Snippet). The snippet then hides the page right after it started and shows it again after all experiments have been applied, after 2 seconds at the latest.
  • If the page stays blank for 2 seconds, an experiment waits for something that does not happen (for example an element that never appears). Check the console for errors.
  • With Use your own custom mode, ABlyft does not hide anything. You have to hide and show the page yourself.
  • Slow changes caused by a long chain of redirects or by content that loads late cannot be fully hidden. Ask your developer to check the load order.

Selectors do not find elements

Variation changes use CSS selectors. If an element is not on the page yet, ABlyft waits and applies the change when it appears. For your own code, use the same approach:

ablyftTools.waitForElement('.promo-banner', function (element) {
  element.textContent = 'Free shipping today';
});

Check selectors in the console with document.querySelectorAll('your selector'). Selectors that include generated class names change with each release of your website. See Dynamic content.

JavaScript errors in experiment or variation code

Code of the project, of an experiment and of a variation is run by the snippet. An error in it is caught, so your website keeps working, but the rest of this code does not run.

  • In debug mode, the error appears in the console as ABlyft # ERROR on EXPERIMENT <id>: <message> (or VARIATION).
  • JavaScript rules for environments, pages and audiences that throw an error count as not matched. The console shows JS RULE with the message.
  • Test the rule or the code in the console to find the faulty line.

Subscribe to the ablyftError event to report these errors to your own monitoring, see Verify the integration.

If your project uses Prerequisites for tracking (for example a consent rule), ABlyft keeps data in memory and sends no events until the rule is met. Symptoms:

  • Visitors get a new assignment on each page view, or experiments do not stay stable.
  • No events appear in the Live Log, and Tracking Prerequisite Rules NOT met shows in the console.

Check that your consent manager calls enableTrackingConsent and read the state with ablyft.get('trackingConsentEnabled'). See Consent manager.

Single-page applications

If experiments only work on the first page and not after navigation, the page is not checked again. Use a page with the trigger URL Change, enable Use SPA features in the project settings, or activate pages with ablyft.push({ eventType: 'activatePage', pageId: … }). See SPA navigation.

A goal is not measured

  • Check the goal in preview mode with ablyft.get('pingedGoals'): if the goal appears, it fires correctly.
  • Click goals: the CSS selector must match the clicked element or one of its parents, and the goal must be assigned to an active page. Also check for JavaScript errors on the page, because they can stop other scripts.
  • Custom and revenue goals: the eventName must be identical to the API name of the goal. See Custom goals.
  • Goal counted once: goals with the counting method One are sent only once per variation and visitor. To test again, delete the ablyft_tgoals entry in the configured storage (see Storage & privacy).
  • Another domain: if the goal is on a different domain, configure External tracking domains, see Snippet settings.

The visitor keeps seeing the same variation

That is intended. The assignment is saved in the configured storage (ablyft_exps, see Storage & privacy), and the visitor stays in the same variation. For tests, use a private window or delete the website data. Use ?ablyft_set_bucketing=… only if you must set an assignment by hand, see URL parameters.

Still stuck?

Contact ABlyft support. Please send the URL of the page, the project and experiment ID, the output of ablyft.get('data') and the console output with debug mode turned on.

Next steps

On this page