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

# Google Analytics

> Google Analytics is a platform that collects data from your websites and apps to create reports that provide insights into your business.

## Usage

### Receiving Tracking ID

To enable Google Analytics on your website, you need to create an account on the [Google Analytics website](https://analytics.google.com/). After creating an account, you will receive a tracking ID that you need to add to your website.

### Adding Tracking ID

To add the tracking ID to your website, you need to set the .env variable `NEXT_PUBLIC_GOOGLE_ANALYTICS_ID` to the tracking ID you received from Google Analytics.

```bash theme={null}
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
```

### Enabling Google Analytics

To enable Google Analytics on your website, set `config.services.googleAnalytics` to `true` in `web/config.tsx`

```typescript jsx web/appConfig.tsx theme={null}
export const config: AppConfig = {
    // ...
    services: {
        // ...
        googleAnalytics: true,
    },
};
```

### Recording Events

Follow the [Next.js Third Party Libraries documentation](https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries#google-analytics). You can see your events under `Reports` > `Realtime`.
