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

# Google Analytics

> Connect Google Analytics to measure visitors on the public site, and show website traffic on the admin dashboard.

MagicBook can send visitor data to Google Analytics in two places: the public site, and the admin dashboard, where it shows traffic.

## Public site

**1. Create a property**

In [Google Analytics](https://analytics.google.com/), create a property and a web data stream for your site. Copy the **Measurement ID**, which starts with `G-`.

**2. Save the ID**

Open **Backend Settings → Global Settings**, turn on **Enable Google Analytics for Homepage**, paste the ID into **Google Analytics Tracking ID** and press **Save**.

## Admin dashboard

The admin dashboard can show website traffic from Google Analytics. It uses a service account, so no one signs in to Google.

**1. Create a service account**

In the Google Cloud Console, create a service account for the project that holds your property. Give it the **Viewer** role on the Google Analytics property, then create a JSON key for it.

**2. Find the property ID**

In Google Analytics, open **Admin** and copy the numeric **Property ID**.

**3. Save the settings**

In **Global Settings**, turn on **Enable Google Analytics for Admin Dashboard**, paste the **Google Analytics Property ID**, and upload the **Google Service Account Credentials** JSON file. Press **Save**.

The dashboard shows **Connect Google Analytics to see website visitors here** until the property ID and the credentials file are both saved.

> [!NOTE]
>
> Keep the JSON key private. Anyone with it can read your analytics data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.