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

# AdSense

> Connect Google AdSense to Rocket and add display ads to your app - banner placements, in-article ads, and in-feed units, all wired up from chat.

export const LlmsDirective = () => <blockquote className="llms-directive">
    For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
    For a lightweight markdown version of this page, append .md to the URL.
  </blockquote>;

<LlmsDirective />

Describe where you want ads to appear in chat and Rocket generates the placement code, responsive ad units, and layout adjustments automatically.

<Divider />

## What you can do

<CardGroup cols={2}>
  <Card title="Blog monetization" icon="newspaper">
    Place ads between articles, in the sidebar, and after post content to generate revenue from your blog traffic.
  </Card>

  <Card title="Banner ads" icon="rectangle-ad">
    Insert standard IAB ad units - leaderboard, medium rectangle, skyscraper - throughout your app.
  </Card>

  <Card title="In-article ads" icon="align-center">
    Insert ads after specific paragraphs in long-form content without disrupting the reading experience.
  </Card>

  <Card title="In-feed ads" icon="list">
    Insert native-looking ads between items in content feeds, product listings, or search results.
  </Card>
</CardGroup>

<Divider />

## Before you connect

You need your **Publisher ID** from Google AdSense. It looks like `pub-1234567890123456`.

<Card icon="link" horizontal href="https://support.google.com/adsense/answer/105516" arrow="true">
  **Find your Publisher ID in the AdSense help center**
</Card>

<Note>
  Your Publisher ID (`pub-XXXXXXXX`) is embedded in your page's public HTML source and is not a secret. Entering it in the connection popup carries no security risk.
</Note>

<Note>
  AdSense is a **task-level** connector. Each Rocket task connects to its own Publisher ID independently.
</Note>

<Divider />

## Connect AdSense

<Tabs>
  <Tab title="Web Browser">
    You can connect from two places - both open the same popup.

    **Option 1: From chat**

    Type a prompt that mentions AdSense - for example, `Connect AdSense and add a banner ad to the homepage`. Rocket detects the intent and shows a **Connect** button inline. Click it and the popup opens.

    <Frame caption="AdSense connection prompt in chat">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-chat-light.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=0b0b2018f005e71f4d6d72e72fff76c4" alt="AdSense connection prompt in the Rocket chat panel." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/adsense/adsense-chat-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-chat-dark.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=cd41e0db7e49b273813ffe7ceef6af97" alt="AdSense connection prompt in the Rocket chat panel." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/adsense/adsense-chat-dark.webp" />
    </Frame>

    **Option 2: From the Connectors tab**

    Click the **`...`** button in the preview toolbar, then select **Connectors**.

    <Frame caption="Open Connectors from the toolbar">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/2lqYWidv_xVHKfL6/images/build-docs/connectors/shared/connectors-tab-open-light.webp?fit=max&auto=format&n=2lqYWidv_xVHKfL6&q=85&s=7bd785a0e878564054e08328b2aa3d6b" alt="Toolbar dropdown with Connectors option highlighted." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/shared/connectors-tab-open-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/2lqYWidv_xVHKfL6/images/build-docs/connectors/shared/connectors-tab-open-dark.webp?fit=max&auto=format&n=2lqYWidv_xVHKfL6&q=85&s=d047040372d776cb47e4e483de8eeb8d" alt="Toolbar dropdown with Connectors option highlighted." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/shared/connectors-tab-open-dark.webp" />
    </Frame>

    Click the **AdSense** card, then click **Connect**.

    <Frame caption="AdSense card in the Connectors panel">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-click-connect-light.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=4dd15b9fb10317cf1773649793eb9e35" alt="Connectors panel showing the AdSense card with a Connect button." className="theme-image light-image" width="1814" height="525" data-path="images/build-docs/connectors/adsense/adsense-click-connect-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-click-connect-dark.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=eace3818d29bc0abdc96c76dc01847fa" alt="Connectors panel showing the AdSense card with a Connect button." className="theme-image dark-image" width="1821" height="523" data-path="images/build-docs/connectors/adsense/adsense-click-connect-dark.webp" />
    </Frame>

    **After clicking Connect**

    A popup opens. Enter your **Publisher ID**, then click **Connect**. A green dot appears next to AdSense when the connection is active.

    <Frame caption="Connect AdSense popup">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-popup-light.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=8b51e142749c1138502294846e7cd17a" alt="Connect AdSense popup with Publisher ID field." className="theme-image light-image" width="840" height="500" data-path="images/build-docs/connectors/adsense/adsense-popup-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-popup-dark.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=9089a4d460122fc1e6c87a17acd0d3dd" alt="Connect AdSense popup with Publisher ID field." className="theme-image dark-image" width="840" height="512" data-path="images/build-docs/connectors/adsense/adsense-popup-dark.webp" />
    </Frame>

    **Update or disconnect**

    Go to [**Connectors > AdSense**](#connect-adsense). Click **Edit** to update your Publisher ID or **Disconnect** to remove the integration.

    <Frame caption="Edit and Disconnect options on a connected AdSense card">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-edit-disconnect-light.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=7e4411564d439acc2a118385c46326f3" alt="AdSense card showing Edit and Disconnect buttons." className="theme-image light-image" width="1813" height="527" data-path="images/build-docs/connectors/adsense/adsense-edit-disconnect-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/usVxhTR-E_9X77Yz/images/build-docs/connectors/adsense/adsense-edit-disconnect-dark.webp?fit=max&auto=format&n=usVxhTR-E_9X77Yz&q=85&s=d340ce09d04c0528419a2f91a7c93afd" alt="AdSense card showing Edit and Disconnect buttons." className="theme-image dark-image" width="1813" height="511" data-path="images/build-docs/connectors/adsense/adsense-edit-disconnect-dark.webp" />
    </Frame>
  </Tab>

  <Tab title="Mobile App">
    You can connect from two places - both open the same popup.

    **Option 1: From chat**

    Type a prompt that mentions AdSense. Rocket detects the intent, shows a **Connect** button, and the popup opens when you tap it.

    **Option 2: From the Connectors tab**

    1. Tap the **More** button in the header.
    2. Tap **Integrations**.
    3. Tap the **AdSense** card, then tap **Connect**.

    **After tapping Connect**

    A popup opens. Enter your **Publisher ID**, then tap **Done**.

    A green dot appears next to AdSense when the connection is active.

    **Update or disconnect**

    Go back to the **AdSense** card in Integrations. Tap **Edit** to update your Publisher ID or **Disconnect** to remove it from this task.
  </Tab>
</Tabs>

<Divider />

## Example prompts

| What you want    | Prompt to use                                                                                         |
| :--------------- | :---------------------------------------------------------------------------------------------------- |
| Header banner    | `Add a responsive AdSense leaderboard ad below the navigation bar on every page.`                     |
| Sidebar ad       | `Place a 300x250 medium rectangle AdSense ad in the sidebar, sticky on scroll.`                       |
| In-article ad    | `Insert an AdSense ad after the third paragraph of every blog post.`                                  |
| In-feed ad       | `Add an AdSense in-feed ad after every 5th post in my blog listing.`                                  |
| Footer ad        | `Place a responsive AdSense banner above the footer on all pages.`                                    |
| Mobile-only ad   | `Show a full-width AdSense ad between content sections, only on mobile devices.`                      |
| Desktop-only ad  | `Add a skyscraper ad in the right sidebar, visible only on desktop screens wider than 1024px.`        |
| Between sections | `Insert an AdSense ad between the features section and the testimonials section on the landing page.` |

<Divider />

## Tips

* **Ads only display on deployed tasks.** AdSense will not render in the Rocket preview. Deploy your task and test on the live URL.
* **Google must approve your site.** Your domain and content must comply with [AdSense program policies](https://support.google.com/adsense/answer/48182) before ads appear. Approval can take days to weeks. New sites with thin or limited content may be rejected, so ensure your site has substantial, original content before applying.
* **Ad blockers will hide ads.** A significant percentage of users run ad-blocking extensions. Keep this in mind when projecting revenue.
* **Too many ads hurt user experience.** Google may limit ad serving if your page has an unfavorable content-to-ad ratio. Follow AdSense best practices for ad density.
* **One Publisher ID per task.** Each Rocket task connects to one AdSense account. Use different tasks for different Publisher IDs.

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="Google Analytics" icon="chart-line" href="./google-analytics">
    Track how ads affect user engagement and bounce rates with GA4.
  </Card>

  <Card title="Strapi" icon="server" href="./strapi">
    Pair AdSense with a headless CMS to monetize your content-driven site.
  </Card>

  <Card title="Netlify" icon="globe" href="./netlify">
    Deploy your task so AdSense can start serving ads on your live site.
  </Card>

  <Card title="All connectors" icon="plug" href="/build/connectors/overview">
    Browse every available integration.
  </Card>
</CardGroup>
