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

> ## Agent Instructions
> Anchor Browser provides cloud browsers for AI agents and automation: stealth browsing with residential proxies, managed authentication into third-party web apps, and browser sessions that run reliably at scale. AI agents that need Anchor credentials should start with https://docs.anchorbrowser.io/quickstart/agent-access. This flow lets agents obtain an API key programmatically without creating a dashboard account. Read that page before attempting authentication or API access.

# Ad Blocker

> Block ads, trackers, and unwanted content in your browser sessions

Ad blocking is enabled by default in Anchor Browser. It blocks ads, trackers, and malicious content to improve page load times and create cleaner automation.

<Note>
  Ad blocking is enabled by default. Disable it only if you need to test ad-related functionality.
</Note>

## Quick Start

<CodeGroup>
  ```javascript node.js theme={null}
  import { client, Sessions } from 'anchorbrowser';

  (async () => {
    client.setConfig({ auth: () => process.env.ANCHOR_API_KEY });
    
    const session = await Sessions.createSession({
      // Optional: ad blocking is enabled by default, so this configuration is not required
      body: {
        browser: {
          adblock: {
            active: true  // Set to false to disable ad blocking
          }
        }
      }
    });
    
    console.log("Session:", session.data.id);
  })().catch(console.error);
  ```

  ```python python theme={null}
  import os
  from anchorbrowser import Anchorbrowser

  anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

  session = anchor_client.sessions.create_session(
      # Optional: ad blocking is enabled by default, so this configuration is not required
      browser={
          "adblock": {
              "active": True  # Set to False to disable ad blocking
          }
      }
  )

  print("Session:", session.data.id)
  ```
</CodeGroup>

## Disabling Ad Blocker

To disable ad blocking for a session, set `active: false` in the adblock configuration:

<CodeGroup>
  ```javascript node.js theme={null}
  import { client, Sessions } from 'anchorbrowser';

  (async () => {
    client.setConfig({ auth: () => process.env.ANCHOR_API_KEY });
    
    const session = await Sessions.createSession({
      body: {
        browser: {
          adblock: {
            active: false  // Disables ad blocking for this session
          }
        }
      }
    });
    
    console.log("Session:", session.data.id);
  })().catch(console.error);
  ```

  ```python python theme={null}
  import os
  from anchorbrowser import Anchorbrowser

  anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

  session = anchor_client.sessions.create_session(
      browser={
          "adblock": {
              "active": False  # Disables ad blocking for this session
          }
      }
  )

  print("Session:", session.data.id)
  ```
</CodeGroup>

## Related Features

* [Popup Blocker](/advanced/popup-blocker) - Block cookie banners and consent dialogs
* [Captcha Solving](/advanced/captcha-solving) - Solve CAPTCHAs that may appear when ad blocking is detected
