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

# Troubleshooting

> Solutions to the most common AdXensor integration issues.

Solutions to the most common integration issues.

## Ads are not showing

<Steps>
  <Step title="Check your Site ID">
    Make sure the `data-ad-client` attribute (CDN) or `siteId` config (npm) matches the Site ID shown in **Publisher Dashboard → My Sites → \[Your Site] → Integration**.

    The ID must start with `pub-` (e.g. `pub-A1B2C3D4`). Trailing spaces or typos will silently break the integration.
  </Step>

  <Step title="Check site approval status">
    Your site must be in **Active** status. If it is still **Pending review**, ads will not serve.

    Go to **Publisher Dashboard → My Sites** and check the status badge next to your site.
  </Step>

  <Step title="Check that the script is loading">
    Open your browser **DevTools → Network** tab, reload the page, and filter by `adxensor`. You should see:

    * A request to `cdn.adxensor.com/tag.js` → status 200
    * A request to `core.adxensor.com/v1/ping` → status 204

    If `tag.js` is not loading, check:

    * Typos in the CDN URL
    * Content Security Policy blocking external scripts (see [CSP](#content-security-policy-csp))
    * Ad blockers enabled on your test browser (test in Incognito/Private mode without extensions)
  </Step>

  <Step title="Check the <ins> markup">
    Every slot must have:

    ```html theme={null}
    <ins class="adxensor"        <!-- required: exactly "adxensor" -->
         style="display:block"  <!-- required: prevents slot from collapsing -->
         data-ad-slot="..."
         data-ad-format="...">
    </ins>
    ```

    Common mistakes:

    * `class="adXensor"` — case-sensitive, must be lowercase `adxensor`
    * Missing `style="display:block"` — the slot collapses to 0 height and the SDK skips it
    * Self-closing `<ins />` — use a proper open/close tag pair
  </Step>

  <Step title="Enable debug mode">
    Add `data-debug` to the script tag (CDN) or set `debug: true` (npm) and check the browser console:

    ```html theme={null}
    <script async
      src="https://cdn.adxensor.com/tag.js"
      data-ad-client="pub-XXXXXXXX"
      data-debug>
    </script>
    ```

    The SDK will log every slot it finds, every API request it makes, and any errors.
  </Step>
</Steps>

## Ads show on one page but not another

This is usually a SPA/navigation issue. The SDK initializes once when the script loads. If you navigate client-side (React Router, Next.js router, Vue Router), the script does not re-run.

**Fix:** Call `AdXensor.reset()` then `adx.init()` on each route change.

→ See the framework-specific guides for exact code:

* [Next.js — route change handler](/publishers/integrations/nextjs)
* [React — AdXensorProvider](/publishers/integrations/react)

## Duplicate ads on the same slot

Multiple calls to `adx.init()` without resetting can cause the same slot to be filled twice.

**Fix:** Call `AdXensor.reset()` before re-initializing, or ensure `adx.init()` is only called once per page lifecycle.

The SDK is idempotent — `.init()` on the same instance is safe to call multiple times — but creating a new instance without resetting the old one will cause duplicates.

## `window is not defined` (SSR/Next.js error)

The SDK accesses browser APIs (`window`, `document`, `navigator`). It will throw if executed on the server.

**Fix:** Always call SDK methods inside `useEffect` (React/Next.js) or `onMounted` (Vue), never at module level.

```tsx theme={null}
// ❌ Wrong — runs during SSR
const adx = AdXensor.getInstance({ siteId: 'pub-...' });

// ✅ Correct — runs only in the browser
useEffect(() => {
  const adx = AdXensor.getInstance({ siteId: 'pub-...' });
  adx.init();
}, []);
```

## Content Security Policy (CSP)

If your site uses a strict CSP, add these directives to allow AdXensor assets:

```
script-src  'self' https://cdn.adxensor.com;
connect-src 'self' https://core.adxensor.com;
img-src     'self' https://cdn.adxensor.com data:;
frame-src   'self' https://cdn.adxensor.com;
```

The `frame-src` directive is needed for HTML creatives (rendered in a sandboxed `<iframe>`).

## Ad blockers

Many ad blockers block requests to `cdn.adxensor.com` and `core.adxensor.com`. This is expected behaviour and cannot be fully prevented. During development, always test in a clean browser profile without extensions, or use Incognito mode.

## Slots fill on desktop but not on mobile

This can happen if:

* Your container is narrower than the requested format. Use `data-ad-format="auto"` to let the SDK choose the appropriate size.
* The script tag is not in `<head>` on the mobile version of your page (some themes conditionally include scripts).

## Still stuck?

* **Email** — [support@adxensor.com](mailto:support@adxensor.com)
* **Dashboard** — [publisher.adxensor.com](https://publisher.adxensor.com)

Include your **Site ID**, the URL of the affected page, and the browser console output with `data-debug` enabled.
