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

# Google Analytics Plugin

> GA4 for Streamly storefront — Measurement ID, optional Measurement Protocol secret.

**Google Analytics 4** (`analytics.google_analytics`) is a Streamly **plugin** in the **analytics** category.

Injects GA4 on the viewer storefront. Optional `apiSecret` enables server-side Measurement Protocol events.

## Learn the service

Watch this overview of the vendor platform (helpful before you paste keys into Streamly).

<Frame caption="Getting started with the Google Analytics property — Google Analytics.">
  <iframe src="https://www.youtube.com/embed/S708NFbvTXI" title="Getting started with the Google Analytics property" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen />
</Frame>

## At a glance

| | |
| - | - |
| **Plugin ID** | `analytics.google_analytics` |
| **Primary key** | `measurementId` (`G-…`) |

## How it works

Storefront analytics components load your Measurement ID. Server helpers can send MP events when `apiSecret` is set.

## Activation keys

Configure in `/admin/plugins` → **Google Analytics 4** → Configure. Secret fields stay server-side — never commit them or expose as `NEXT_PUBLIC_*` unless the key is intentionally public (e.g. Stripe publishable key).

| Key | Label | Required | Secret | Docs |
| - | - | - | - | - |
| `measurementId` | Measurement ID (`G-…`) | Yes | No | [Help](https://support.google.com/analytics/answer/9539598) |
| `apiSecret` | Measurement Protocol API secret | Optional | Yes | [MP](https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events) |

## Setup guide

<Steps>
  <Step title="Create GA4 web stream">Copy Measurement ID.</Step>
  <Step title="Install plugin">Paste `measurementId`.</Step>
  <Step title="Optional MP secret">GA4 Admin → Data stream → Measurement Protocol.</Step>
  <Step title="Verify">Realtime report / Tag Assistant on storefront.</Step>
</Steps>

## Admin & Settings paths

| Path | Purpose |
| - | - |
| `/admin/plugins` | Keys |
| `/admin/settings?tab=analytics` | Status |

## Official vendor documentation

* [Measurement ID](https://support.google.com/analytics/answer/9539598)
* [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events)

## Related

* [Meta Pixel](/plugins/meta-pixel)
* [GTM](/plugins/google-tag-manager)
* [Plugins Overview](/plugins/overview)


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