> ## Documentation Index
> Fetch the complete documentation index at: https://nango-wari-migrated-bigcommerce-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Analytics

> Integrate your application with the Google Analytics API

## 🚀 Quickstart

Connect to Google Analytics with Nango and see data flow in 2 minutes.

<Steps>
  <Step title="Create an integration">
    In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *Google Analytics*.

    <Note>
      Nango has credentials you can use for testing. Activate them in the dashboard.
    </Note>
  </Step>

  <Step title="Authorize Google Analytics">
    Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then log in to Google Analytics. Later, you'll let your users do the same directly from your app.
  </Step>

  <Step title="Call the Google Analytics API">
    Let's make your first request to the Google Analytics Admin API (fetch a list of accounts). Replace the placeholders below with your [secret key](https://app.nango.dev/dev/environment-settings), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

    <Tabs>
      <Tab title="cURL">
        ```bash theme={null}
        curl "https://api.nango.dev/proxy/v1beta/accounts?pageSize=10" \
          -H "Authorization: Bearer <NANGO-SECRET-KEY>" \
          -H "Provider-Config-Key: <INTEGRATION-ID>" \
          -H "Base-Url-Override: https://analyticsadmin.googleapis.com" \
          -H "Connection-Id: <CONNECTION-ID>"
        ```
      </Tab>

      <Tab title="Node">
        Install Nango's backend SDK with `npm i @nangohq/node`. Then run:

        ```typescript theme={null}
        import { Nango } from '@nangohq/node';

        const nango = new Nango({ secretKey: '<NANGO-SECRET-KEY>' });

        const res = await nango.get({
            endpoint: '/v1beta/accounts',
            params: {
              pageSize: 10
            },
            providerConfigKey: '<INTEGRATION-ID>',
            connectionId: '<CONNECTION-ID>',
            // Base Override here as we are accessing the Admin Rest API
            // https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1beta/accounts/list
            baseUrlOverride: 'https://analyticsadmin.googleapis.com',
        });

        console.log(res.data);
        ```
      </Tab>
    </Tabs>

    Or fetch credentials with the [Node SDK](/reference/sdks/node#get-a-connection-with-credentials) or [API](/reference/api/connection/get).

    ✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.
  </Step>

  <Step title="Implement Nango in your app">
    Follow our [Auth implementation guide](/guides/primitives/auth) to integrate Nango in your app.

    To obtain your own production credentials, follow the setup guide linked below.
  </Step>
</Steps>

## 📚 Google Analytics Integration Guides

Nango maintained guides for common use cases.

* [How to register your own Google Analytics OAuth app](/api-integrations/google-analytics/how-to-register-your-own-google-analytics-api-oauth-app)\
  Register an OAuth app with Google Analytics and obtain credentials to connect it to Nango

* [Google App & Security Review](/api-integrations/google-shared/google-security-review)
  Pass Google's OAuth app verification to go to production

Official docs: [Google Analytics API documentation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest)

## 🧩 Pre-built syncs & actions for Google Analytics

Enable them in your dashboard. Extend and customize to fit your needs.

### Others

| Function name              | Description                                                 | Type                                           | Source code                                                                                                                               |
| -------------------------- | ----------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `archive-conversion-event` | Archive a GA4 conversion event.                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/archive-conversion-event.ts) |
| `batch-run-reports`        | Run multiple GA4 reports in one request.                    | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/batch-run-reports.ts)        |
| `create-conversion-event`  | Create a conversion event for a GA4 property.               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/create-conversion-event.ts)  |
| `create-data-stream`       | Create a data stream for a GA4 property.                    | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/create-data-stream.ts)       |
| `create-property`          | Create a GA4 property under an account.                     | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/create-property.ts)          |
| `get-metadata`             | Retrieve GA4 dimensions and metrics metadata.               | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/get-metadata.ts)             |
| `run-pivot-report`         | Run a GA4 pivot report.                                     | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/run-pivot-report.ts)         |
| `run-realtime-report`      | Run a realtime GA4 report.                                  | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/run-realtime-report.ts)      |
| `run-report`               | Run a GA4 report for a property                             | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/run-report.ts)               |
| `update-data-stream`       | Update a GA4 data stream.                                   | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/update-data-stream.ts)       |
| `update-property`          | Update a GA4 property.                                      | [Action](/guides/functions/action-functions)   | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/actions/update-property.ts)          |
| `accounts`                 | Sync accessible Google Analytics accounts.                  | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/syncs/accounts.ts)                   |
| `audiences`                | Sync GA4 audiences for properties.                          | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/syncs/audiences.ts)                  |
| `conversion-events`        | Sync configured GA4 key events (formerly conversion events) | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/syncs/conversion-events.ts)          |
| `data-streams`             | Sync web, iOS, and Android data streams for GA4 properties. | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/syncs/data-streams.ts)               |
| `properties`               | Sync GA4 properties across accessible accounts.             | [Sync](/guides/functions/syncs/sync-functions) | [🔗 Github](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-analytics/syncs/properties.ts)                 |

***
