> ## 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.

# Google Analytics

> Connect Google Analytics GA4 to Rocket and track page views, conversions, and traffic sources: 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 what you want to measure in chat and Rocket wires up the tracking tags, custom events, and e-commerce data layer automatically.

<Divider />

## What you can do

<CardGroup cols={2}>
  <Card title="Traffic and page view tracking" icon="eye">
    See which pages users visit most, where they come from, and how long they stay.
  </Card>

  <Card title="Conversion goals" icon="bullseye">
    Track key actions like signups, form submissions, and purchases as GA4 conversion events.
  </Card>

  <Card title="E-commerce tracking" icon="cart-shopping">
    Send product views, add-to-cart actions, and purchase events to GA4 for revenue reporting.
  </Card>

  <Card title="Audience insights" icon="users">
    Understand your user demographics, devices, and geographic distribution.
  </Card>

  <Card title="Custom event tracking" icon="crosshairs">
    Track any interaction as a custom GA4 event with parameters you define.
  </Card>
</CardGroup>

<Divider />

## Before you connect

You need your **Measurement ID** from Google Analytics. It starts with `G-`, for example `G-XXXXXXXXXX`.

<Card icon="arrow-up-right-from-square" horizontal href="https://support.google.com/analytics/answer/12270356?hl=en" arrow="true">
  **Find your Measurement ID** from the Google Analytics help centre.
</Card>

Go to **Admin > Data Streams**, click your stream, and copy the **Measurement ID**.

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

<Divider />

## Connect Google Analytics

<Tabs>
  <Tab title="Web Browser">
    You can connect from two places. Both do the same thing.

    **Option 1: From chat**

    Type a prompt that mentions Google Analytics, for example `Connect Google Analytics and track page views on every route`. Rocket detects the intent and shows a **Connect** button inline. Click it to open the credentials popup.

    <Frame caption="Google Analytics connection prompt in chat">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-chat-light.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=d54e06299c416f6defef60a68ce7dc80" alt="Rocket chat panel showing a Connect prompt for Google Analytics." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-chat-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-chat-dark.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=cdb44af5342b4b933923a090dfd24069" alt="Rocket chat panel showing a Connect prompt for Google Analytics." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-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 **Google Analytics** card, then click **Connect**.

    <Frame caption="Google Analytics card in the Connectors panel">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-connectors-tab-light.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=9771522feb8b36dac47af86524baede2" alt="Connectors panel showing the Google Analytics card with a Connect button." className="theme-image light-image" width="1817" height="520" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-connectors-tab-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-connectors-tab-dark.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=614ddff738b8f5e223e60252f6c14d54" alt="Connectors panel showing the Google Analytics card with a Connect button." className="theme-image dark-image" width="1823" height="527" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-connectors-tab-dark.webp" />
    </Frame>

    **After clicking Connect**

    A popup opens. Enter your **Measurement ID**, then click **Connect**.

    <Frame caption="Connect Google Analytics popup">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-popup-light.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=35a3144295a0aec82794f26ccfbb2f4d" alt="Connect Google Analytics popup with Measurement ID field." className="theme-image light-image" width="840" height="504" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-popup-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-popup-dark.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=8879515b1052dc22f87476f3a1bd3076" alt="Connect Google Analytics popup with Measurement ID field." className="theme-image dark-image" width="840" height="504" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-popup-dark.webp" />
    </Frame>

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

    **Update or disconnect**

    Open [**Connectors > Google Analytics**](#connect-google-analytics) and click the card. Click **Edit** to update your Measurement ID or **Disconnect** to remove the integration from this task.

    <Frame caption="Edit and Disconnect options on a connected Google Analytics card">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-disconnect-light.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=e8099e44f461a15b028bae7457e121bd" alt="Google Analytics card showing Edit and Disconnect buttons." className="theme-image light-image" width="1824" height="526" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-disconnect-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PMhgGqf0Gxy-8x42/images/build-docs/connectors/google-analytics/web-browser/google-analytics-disconnect-dark.webp?fit=max&auto=format&n=PMhgGqf0Gxy-8x42&q=85&s=aa2016d31874455a4acafc69edda956a" alt="Google Analytics card showing Edit and Disconnect buttons." className="theme-image dark-image" width="1823" height="517" data-path="images/build-docs/connectors/google-analytics/web-browser/google-analytics-disconnect-dark.webp" />
    </Frame>
  </Tab>

  <Tab title="Mobile App">
    You can connect from two places. Both do the same thing.

    **Option 1: From chat**

    Type a prompt that mentions Google Analytics. Rocket detects the intent and shows a **Connect** button inline. Tap it to open the credentials screen.

    **Option 2: From the Connectors tab**

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

    **After tapping Connect**

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

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

    **Update or disconnect**

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

<Divider />

## Example prompts

| What you want       | Prompt to use                                                                         |
| :------------------ | :------------------------------------------------------------------------------------ |
| Page views          | `Track page views on every route and send them to Google Analytics automatically.`    |
| Button clicks       | `Track clicks on the Sign Up and Contact Sales buttons as GA4 custom events.`         |
| Form submissions    | `Send a conversion event to GA4 when users submit the contact form.`                  |
| E-commerce purchase | `Track completed purchases with order total, product names, and quantities in GA4.`   |
| Scroll depth        | `Track when users scroll past 25%, 50%, 75%, and 100% of the page.`                   |
| Outbound links      | `Track clicks on external links as GA4 events with the destination URL.`              |
| Search tracking     | `Send a search event to GA4 when users use the site search bar, including the query.` |
| Video engagement    | `Track play, pause, and completion events for embedded videos in GA4.`                |
| UTM attribution     | `Parse UTM parameters from the URL and forward them to GA4 as campaign data.`         |
| User properties     | `Set GA4 user properties for plan type and signup date when users log in.`            |

<Divider />

## Tips

* **Tracking only works on deployed tasks.** Google Analytics does not fire events in the Rocket preview. Deploy your task and test on the live URL.
* **GA4 data has a processing delay.** Real-time reports update within seconds, but standard reports may take 24 to 48 hours to fully populate.
* **Only GA4 Measurement IDs are supported.** IDs start with `G-`. Universal Analytics (`UA-`) was sunset in 2024 and no longer processes data.
* **Ad blockers may prevent tracking.** Some users run browser extensions that block Google Analytics scripts. Keep this in mind when evaluating traffic numbers.
* **One Measurement ID per task.** Each Rocket task connects to one Google Analytics property. Use different tasks for different properties.

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="Mixpanel" icon="chart-mixed" href="./mixpanel">
    Need deeper event-level analytics? Add Mixpanel for funnel analysis and user segmentation.
  </Card>

  <Card title="Stripe" icon="credit-card" href="./stripe">
    Track checkout conversion rates and revenue attribution with Stripe and GA4 together.
  </Card>

  <Card title="AdSense" icon="money-bill" href="./adsense">
    Monetize your traffic with Google AdSense display ads.
  </Card>

  <Card title="Netlify" icon="globe" href="./netlify">
    Deploy your task so Google Analytics can start collecting real data.
  </Card>
</CardGroup>
