> For the complete documentation index, see [llms.txt](https://docs.getpurpledot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getpurpledot.com/integrations/analytics/google-analytics/connect.md). Agents can also search and read this documentation through its [MCP server](https://docs.getpurpledot.com/~gitbook/mcp).

# Connect Google Analytics

Connect Google Analytics to receive events from the Purple Dot checkout.

Background: [How analytics integrations work](https://docs.getpurpledot.com/integrations/analytics/how-analytics-integrations-work.md#checkout-events).

{% hint style="warning" %}
Purple Dot sends Google Analytics the sale when the shopper places the pre-order. When you release it, Purple Dot also creates an order in your e-commerce platform, and a connection that reads platform orders can record the sale again. After a test release, check that the new order doesn't duplicate the sale in Google Analytics. See [De-duplicating orders at release](https://docs.getpurpledot.com/understanding-purple-dot/pre-order-timing-and-your-reporting.md#de-duplicating-orders-at-release).
{% endhint %}

## Before you start

* [Set up Google Analytics storefront tracking](https://docs.getpurpledot.com/integrations/analytics/google-analytics/set-up-storefront-tracking.md), or verify your existing tag or pixel.
* Your store sells pre-orders through the Purple Dot checkout.
* You have a **Google Analytics 4** property for the store.
* The GA4 **Google tag** is active on the storefront (for example through the [Google & YouTube](https://apps.shopify.com/google) Shopify app, Google Tag Manager, or a theme tag), and it sets the `_ga` cookie for visitors.
* You have **Editor** (or higher) access to the Google Analytics property. You need it to create an API secret.

## Steps

1. In [Google Analytics](https://analytics.google.com/), go to **Admin** > **Data streams** and open the **Web** data stream used on your storefront.
2. Copy the **Measurement ID** (format `G-XXXXXXXX`).

   <figure><img src="https://2758444809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM5A7csYKEplvsuQqHenE%2Fuploads%2Fgit-blob-7a3fb4dde34a68cd9ad9176fa02a80571556bcb1%2Fanalytics-google-analytics-setup-2.png?alt=media" alt="Google Analytics setup screen"><figcaption></figcaption></figure>
3. On the same data stream, open **Measurement Protocol API secrets**, select **Create**, give the secret a nickname such as `Purple Dot`, and create it.
4. Copy the **Secret value** straight away and store it securely.

   <figure><img src="https://2758444809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM5A7csYKEplvsuQqHenE%2Fuploads%2Fgit-blob-2a7ad01a6d6b3b6bc286ecd544e013515a0f2889%2Fanalytics-google-analytics-setup-3.png?alt=media" alt="Google Analytics setup screen"><figcaption></figcaption></figure>
5. In the Merchant Portal, go to **Settings** > **Integrations**.
6. Under **Analytics**, select **Connect** for **Google Analytics**.
7. Enter the **Measurement ID** and **API Secret** from steps 2 and 4. The Measurement ID must match the web data stream that already collects your storefront's browser events.
8. Optional: select **Test Connection** and wait for **Credentials verified!**. Purple Dot sends a `purple_dot_test` event to Google's Measurement Protocol debug endpoint, which confirms Google accepts the Measurement ID and API Secret.
9. Select **Save**.

Once the connection is saved, Purple Dot sends events automatically.

## Verify

1. Open your storefront and accept cookie consent, so the `_ga` cookie is set.
2. In GA4, open **Reports** > **Realtime** and keep the tab open.
3. Complete a test pre-order: add to cart, open checkout, enter payment details, and complete the order.
4. In **Realtime**, confirm the checkout events appear: `add_to_cart`, `begin_checkout`, `add_payment_info`, and `purchase`.

## Troubleshooting

* [My integration is not syncing](https://docs.getpurpledot.com/troubleshooting/orders-and-inventory/integration-is-not-syncing.md)
* [Get more help](https://docs.getpurpledot.com/troubleshooting/get-more-help.md)

## Related

* **Concept:** [Choosing a checkout method](https://docs.getpurpledot.com/understanding-purple-dot/choosing-a-checkout-method.md)
* **Do this:** [Track pre-order conversion](https://docs.getpurpledot.com/managing-pre-orders/reports-and-data/track-pre-order-conversion.md)
* **Look up:** [Google Analytics events and settings](https://docs.getpurpledot.com/integrations/analytics/google-analytics/events-and-settings.md)
* **Fix it:** [My integration is not syncing](https://docs.getpurpledot.com/troubleshooting/orders-and-inventory/integration-is-not-syncing.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.getpurpledot.com/integrations/analytics/google-analytics/connect.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
