> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abtestly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ABTestly Script Not Working: Installation Troubleshooting

> A diagnostic ladder for the most common install issue: the tag is in the HTML but no variants apply and no beacons fire.

You dropped the snippet in `<head>`. You verified it is there in view
source. You opened your test page in a fresh tab. Nothing happens.

Nine times out of ten it is one of the five things below.

## 1. `window.__ABTESTLY_CONFIG__` is undefined

The snippet did not load. Not "did not run", did not even load.

```js theme={null}
window.__ABTESTLY_CONFIG__
// undefined
```

Check, in order:

* **Is the snippet actually in `<head>`?** Right-click the page → View
  source. Search for `abtestly`. It has to be a `<script>` tag inside
  `<head>`.
* **Is it the first script tag?** Plugins sometimes inject other tags
  above ABTestly. Ours has to be first.
* **Is `cdn.abtestly.com` blocked?** Try incognito with ad blockers
  disabled. Some blockers need it allowlisted.
* **Is the snippet the right one for this domain?** Each site has its
  own snippet, keyed to its own domain. A snippet from `site-a.com`
  running on `site-b.com` does nothing.

If the config still comes back undefined after all of this, the
snippet URL itself is probably not reachable, inspect the Network
tab for a request to `cdn.abtestly.com/s/<key>.js` and its status.

## 2. Config is loaded but has no experiments

```js theme={null}
window.__ABTESTLY_CONFIG__.experiments
// []
```

You have no live experiments on this site.

* Are there any in Live status?
* If yes, are they targeting a Location that matches this page?
* Did you save an experiment but never click Start?

Draft experiments do not go in the config. Only Live and Scheduled
experiments do.

## 3. Config has experiments but none apply

```js theme={null}
window.__abtestly.debug()
```

Look at the events buffer for `assignment` events. If there is none,
the experiment did not consider you.

* **Location did not match.** The URL rules do not match the current
  URL. Open the experiment's Location editor; check operator and case
  sensitivity.
* **Audience did not match.** Your visitor properties (device,
  country, cookie) did not qualify. The debugger tells you which
  rule failed.

## 4. Assignment happened, variant did not apply

Debugger says the assignment succeeded but the change is not visible.

* **Selector typo in variant JS?** `document.querySelector('.hero_cta')`
  when the element is `.hero-cta`. Look for `variant_apply_error`
  events.
* **Element was not on the page yet?** Use
  `abtestly.waitFor(selector, cb)` instead of `querySelector`.
* **SPA that moved past the target?** Turn on SPA support in Settings
  → SPA. Use `onApply` and `onCleanup` in your variant.

## 5. Variant applied, no beacon fired

Debugger shows a `variant_applied` event but no `beacon` event.

* **Consent gate is still deferred.** Check `consentMode` and
  `consentKey`. If consent is deferred and not granted, the runtime
  waits.
* **Visitor is opted out.** Check `__abtestly_optout=1` in the cookies
  for this domain.
* **Preview mode.** Preview never fires real beacons, by design.

## The nuclear option

Open [preview](https://docs.abtestly.com/preview/preview-modal.md) on the experiment. Preview runs
the full targeting flow against the real page, and the preview badge tells
you when the experiment does not target it. Then run
`window.__abtestly.debug()` in the console to see what was assigned, which
goals registered, and what the snippet tried to send. See the
[dev debugger](https://docs.abtestly.com/preview/dev-debugger.md), and note what it
[cannot tell you](https://docs.abtestly.com/preview/dev-debugger.md#what-the-debugger-does-not-prove).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.