---
title: "Google Analytics 4 integration for QR codes and links"
description: "Send every QR code scan, link click, form submission and piece of visitor data captured to Google Analytics 4, server side through the Measurement Protocol. No delay for visitors, no personal data, only people's visits. Setup, events, custom dimensions, and how it compares with the Google tag pixel."
canonical: "https://linkbreakers.com/help/article/google-analytics-4-integration-for-qr-codes-and-links"
last-updated: 2026-10-30
---

# Google Analytics 4 integration for QR codes and links

> Send every QR code scan, link click, form submission and piece of visitor data captured to Google Analytics 4, server side through the Measurement Protocol. No delay for visitors, no personal data, only people's visits. Setup, events, custom dimensions, and how it compares with the Google tag pixel.

:::try-ai-prompt {"prompt":"Connect Google Analytics with my Measurement ID G-ABC123DEF4 and my Measurement Protocol API secret, then send a test event","description":"Connect Google Analytics 4 with the Assistant.","target":"assistant"}:::

## Short answer

Open **Integrations** in the Linkbreakers dashboard, pick **Google Analytics 4**, paste your GA4 Measurement ID (`G-...`) and a Measurement Protocol API secret, and select **Connect**. From then on, every person who scans one of your QR codes or opens one of your links shows up in GA4 as a `qr_scan` or `link_click` event, and each form they submit as a `generate_lead` event, with the link, the city, the country and the device.

Linkbreakers sends the events from its servers, after the redirect, so visitors wait for nothing and ad blockers cannot stop them. Personal data never leaves: GA4 receives the names of the fields a visitor filled in, never what they typed. It is available on every plan, Free included.

## Quick summary

- Connect once per workspace with a Measurement ID and a Measurement Protocol API secret
- Every link and QR code of the workspace is covered
- Sent server side through Google's Measurement Protocol: no script, no delay, no ad blocker in the way
- Events: `qr_scan`, `link_click`, `generate_lead`, `location_shared`, `visitor_data_added`
- Each event carries the link, the short link, a session, the city, the country and the device
- No personal data: field names only, no emails, names, phone numbers, answers or coordinates
- Only people's visits: bots, link previews, AI agents and automated browsers are left out
- Also available from the Assistant, the MCP server, the REST API, the CLI and the SDKs

## How it works

A Google tag runs in the visitor's browser. This integration does not: when a visit happens, Linkbreakers redirects the visitor as usual, then its servers send the event to Google Analytics through the [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4), Google's API for sending events from a server.

Each step of the visit becomes its own event when it happens. A visitor who scans a poster, fills in a form and shares their location produces a `qr_scan`, then a `generate_lead`, then a `location_shared`, all tied to the same GA4 session.

In GA4:

- **The user** is the Linkbreakers device (the GA4 client ID) and, when known, the Linkbreakers visitor ID (the GA4 user ID). A visitor who scans twice is one user with two sessions
- **The session** is the visit, so every step of one visit lands in one session
- **Location and device** use GA4's own fields, so the standard **Country**, **City**, **Device category**, **Operating system** and **Browser** dimensions work in your reports without any setup

## Events sent

| Event | When | Parameters |
|---|---|---|
| `qr_scan` | A person scans a QR code | `visit_type` (`first` or `returning`) |
| `link_click` | A person opens a link (not from a QR code) | `visit_type` (`first` or `returning`) |
| `generate_lead` | A person submits a form step | `form_title`, `fields` (field names, such as `email,company`), `fields_count` |
| `location_shared` | A person shares their location on a Location request step | none beyond the common ones |
| `visitor_data_added` | Any other step saves data to the visitor's profile | `fields` (attribute names), `source` (the step kind) |

Every event also carries `link_id`, `link_name`, `short_link`, `session_id` and `engagement_time_msec`. When a step also saves attributes to the visitor's profile, their names come in `saved_attributes`.

`generate_lead` is one of GA4's recommended events, so GA4 already knows what it means and you can mark it as a key event in one click.

## What is never sent

Google's terms forbid sending personal data to Google Analytics, and a property that receives it can be closed. Linkbreakers never sends:

- Emails, names, phone numbers or any value a visitor typed into a form
- The values of the attributes saved to the visitor's profile
- GPS coordinates from a Location request step
- IP addresses

GA4 gets the names of the fields, such as `email,company`, so you know a lead gave their email without GA4 ever knowing which one. The leads themselves stay in Linkbreakers, where you can [see who scanned](/help/article/qr-code-marketing-how-to-track-engagement-offline-like-a-pro) or send them on with [webhooks](/help/article/how-do-webhooks-work-in-linkbreakers), HubSpot or Slack.

## Who is sent

Only visits classified as **Human**. Crawlers, link previews (Slack, Teams, Discord, WhatsApp, Facebook, LinkedIn), AI agents and recognized automated browsers are never sent, so they do not inflate your GA4 numbers. See [how Linkbreakers detects AI agents and automated browsers](/help/article/how-linkbreakers-detects-ai-agents-and-automated-browsers).

Visits past your plan's tracked visits allowance are recorded but locked, and locked visits reach no integration, Google Analytics included.

## Step-by-step setup

### 1. Find your Measurement ID

In Google Analytics, open **Admin > Data streams**, select your web stream and copy the **Measurement ID**. It starts with `G-`.

### 2. Create a Measurement Protocol API secret

On the same web stream page, open **Measurement Protocol API secrets**, select **Create**, give it a name such as "Linkbreakers" and copy the secret value. GA4 may ask you to accept its data collection terms first.

### 3. Connect it in Linkbreakers

1. Open the dashboard and go to **Integrations**
2. Open **Google Analytics 4**
3. Paste the Measurement ID and the API secret
4. Select **Connect**

The secret is stored encrypted and never shown again. To change property later, paste a new Measurement ID; leave the secret empty to keep the stored one.

### 4. Send a test event

Select **Send test event**. Linkbreakers sends a `linkbreakers_test` event in debug mode. In GA4, open **Admin > DebugView**: it shows up within a minute.

Check DebugView rather than trusting the button alone. Google accepts Measurement Protocol events even with a wrong API secret and silently drops them, so the test can only prove the secret is right if the event appears there.

### 5. Register the custom dimensions

GA4 shows its own fields (country, city, device) everywhere, but custom parameters such as `link_name` only appear in standard reports once registered. In GA4, open **Admin > Custom definitions > Create custom dimension**, choose the **Event** scope and add the ones you need:

| Dimension name | Event parameter |
|---|---|
| Link name | `link_name` |
| Short link | `short_link` |
| Visit type | `visit_type` |
| Form title | `form_title` |
| Fields captured | `fields` |

Dimensions only apply to events received after you create them. Explorations can use the parameters right away.

### 6. Mark leads as a key event

In GA4, open **Admin > Events**, find `generate_lead` once one has arrived, and turn on **Mark as key event**. Form submissions from your QR codes then count as conversions in your reports and can be imported into Google Ads.

## GA4 integration or Google tag pixel?

Linkbreakers has two ways to reach GA4. They do different jobs:

| | Google Analytics 4 integration | [Google tag pixel](/help/article/google-tag-ga4-and-google-ads-for-qr-codes-and-links) |
|---|---|---|
| Where it runs | Linkbreakers' servers | The visitor's browser |
| Delay for the visitor | None | A short page, usually well under a second, at most 1.2 seconds |
| Blocked by ad blockers | No | Yes |
| What GA4 receives | Scans, clicks, leads, shared locations, captured data, with link, country, city and device | A `page_view` with the link address |
| Builds Google Ads remarketing audiences | No | Yes, with an `AW-` tag or a GA4 audience |
| Cookies on the visitor's browser | None | Google's analytics and advertising cookies |

Use the integration for reporting: how many people scanned which QR code, from where, and how many became leads. Use the Google tag pixel when you want to retarget scanners with Google Ads.

You can use both. If both point at the same GA4 property, each visit is counted twice, once as a `page_view` and once as a `qr_scan` or `link_click`. Keep the pixel for Google Ads (`AW-`) and the integration for GA4, or send them to different GA4 properties.

## Set it up from an AI agent, the API or the CLI

**Assistant**: in the dashboard, ask "Connect Google Analytics with G-ABC123DEF4 and my API secret, then send a test event".

**MCP server**: an agent connected to the [Linkbreakers MCP server](/help/article/mcp-server-setup) has `google_analytics_integration_get`, `google_analytics_integration_update`, `google_analytics_integration_test` and `google_analytics_integration_delete`. For example:

> Connect my Linkbreakers workspace to Google Analytics with Measurement ID G-ABC123DEF4 and API secret abcDEF123, send a test event, and tell me what to check in DebugView.

**REST API**, with a token that has the `integrations:write` scope:

```bash
curl -X PUT https://api.linkbreakers.com/v1/integrations/google-analytics \
  -H "Authorization: Bearer $LINKBREAKERS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"measurementId": "G-ABC123DEF4", "apiSecret": "abcDEF123"}'

curl -X POST https://api.linkbreakers.com/v1/integrations/google-analytics/test \
  -H "Authorization: Bearer $LINKBREAKERS_TOKEN" \
  -H "Content-Type: application/json" -d '{}'
```

`GET /v1/integrations/google-analytics` returns the Measurement ID, whether a secret is set, when an event was last sent and the last error, never the secret. `DELETE` disconnects it.

**CLI**, from the next CLI release:

```bash
linkbreakers google-analytics-integrations update --measurement-id G-ABC123DEF4 --api-secret abcDEF123
linkbreakers google-analytics-integrations test
```

The same operations are in the TypeScript, Python, Go, Java and Rust SDKs. See [set up every Linkbreakers integration with an AI agent](/help/article/set-up-linkbreakers-integrations-with-an-ai-agent-mcp) for the other integrations an agent can configure.

## Limits and caveats

- **Scanners are their own GA4 users.** The scan is not joined with the same person's later visit to your website, which GA4 sees through its own cookie. Add [UTM parameters](/help/article/what-is-a-utm-builder-in-linkbreakers) to your destinations to attribute that website visit to the campaign
- **No personal data**, by design. Field names, not values
- **Custom dimensions need registering** in GA4 before they show in standard reports, and only apply from then on
- **Wrong secrets fail silently** on Google's side; check DebugView after connecting
- **One property per workspace.** Use a [workspace per client](/help/article/how-to-manage-qr-codes-for-multiple-clients) to send each client's scans to their own property
- **Workspace-wide.** Every link and QR code of the workspace is sent; filter on `link_name` or `short_link` in GA4
- **Late events.** GA4 accepts events up to 72 hours old; a step sent later than that is dated when it is sent

## Frequently asked questions

### Does it slow down my links?

No. The events are sent from Linkbreakers' servers after the visitor has been redirected.

### Is it included on the Free plan?

Yes. The Google Analytics 4 integration is available on every plan.

### Will form answers end up in Google Analytics?

No. GA4 receives the names of the fields filled in, such as `email` or `company`, never the values. Google's terms forbid personal data in GA4.

### Why don't I see my test event?

Look in **Admin > DebugView**, not in the standard reports, which take up to a day. If it is not there after a minute, the API secret or the Measurement ID is wrong: Google accepts the request either way. Create a new secret on the right web stream and connect again.

### Do I need a consent banner?

The integration sets no cookie and runs no script in the visitor's browser, so there is nothing for a cookie banner to block on the link itself. Sending visit data to Google is still processing on your behalf, so cover Google Analytics in your privacy policy and check what your jurisdiction requires.

### Can I keep using the Google tag pixel?

Yes. Point it at Google Ads, or at a different GA4 property, so visits are not counted twice in the same one.

## Sources

- Linkbreakers Google Analytics 4 integration page, API and MCP tools, checked in the product on 2026-10-30.
- Google Analytics, Measurement Protocol (GA4): https://developers.google.com/analytics/devguides/collection/protocol/ga4
- Google Analytics, Measurement Protocol reference: https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference
- Google Analytics, validate events: https://developers.google.com/analytics/devguides/collection/protocol/ga4/validating-events
- Google Analytics, recommended events (`generate_lead`): https://developers.google.com/analytics/devguides/collection/ga4/reference/events
- Google Analytics Help, custom dimensions and metrics: https://support.google.com/analytics/answer/10075209
- Google Analytics Help, monitor events in DebugView: https://support.google.com/analytics/answer/7201382
- Google Analytics Help, best practices to avoid sending PII: https://support.google.com/analytics/answer/6366371

## Last reviewed

2026-10-30 by Laurent Schaffner.
