# Connect Google Analytics 4

> Connect GA4 to DataFirefly Server-Side through Measurement Protocol: Measurement ID, API secret from the right stream, realtime verification.

- Original page: https://server-side.datafirefly.com/en/docs/ga4.html
- Language: en
- Updated: 2026-09-01
- Publisher: DataFirefly (Datafirefly Limited), https://server-side.datafirefly.com/en/

---

Two values, both in the GA4 admin: your web stream's Measurement ID and an API secret created on that same stream.

## The fields

| Field | Where to find it |
| --- | --- |
| GA4 Measurement ID | GA4 > **Admin > Data streams** > your web stream: identifier in the `G-XXXXXXXXXX` format |
| GA4 API secret | Admin > Data streams > open the stream > **Measurement Protocol API secrets** > **Create** |
| GA4 property ID (optional) | Resolved automatically from the Measurement ID. Only fill it in to force a specific property. |

The API secret must belong to **the same stream** as the Measurement ID. A secret created on another stream is accepted by Google, but the events show up nowhere.

## Verify

A GA4 particularity: Measurement Protocol always answers "OK", even to a broken payload. There is no external validation. Check in two places:

1. The **Delivered** rate in your client area's Monitoring.
2. **GA4 > Reports > Realtime**: send a test event and watch it arrive.

## Channel attribution

Events are sent with the session identifier and the page referrer, which lets GA4 attach conversions to their acquisition channel instead of filing them under "Unassigned".

## If you see duplicates

GA4 only deduplicates the `purchase` event, and only by `transaction_id`. Recent DataFirefly modules therefore no longer send the purchase from the browser: if you see duplicated purchases, [update the module](https://server-side.datafirefly.com/en/docs/troubleshooting.html).

Updated: September 1, 2026
