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

# Google Analytics 4

> Send storekit orders, baskets and product views to Google Analytics 4 through Google Tag Manager, with revenue, items and app vs website orders reported separately.

storekit sends events to Google Analytics 4 (GA4) through your [Google Tag Manager](https://storekit.com/docs/guides/integrations/marketing/google-tag-manager.md) container. There is no separate Google Analytics setting in the dashboard: you add the container to your store, then set up the GA4 tags inside GTM.

## Before You Start

* A GTM container added to your store: **Stores** → your store → **Settings** → **Integrations** → **Google Tag Manager**
* A GA4 property with a web data stream, and its measurement ID (`G-XXXXXXXXXX`)
* Edit access to both. Setting this up does not involve storekit.

## Send storekit Events to GA4

**1. Add the Google tag**

In your Google Tag Manager account, go to **Tags** → **New** → **Google Tag**, enter your measurement ID and set the trigger to **Initialization - All Pages**. This records page views. See Google's [Set up Google Analytics in Tag Manager](https://support.google.com/tagmanager/answer/9442095).

**2. Add a GA4 event tag for the ecommerce events**

In your Google Tag Manager account, create a **Google Analytics: GA4 Event** tag with your measurement ID and **Event Name** set to `{{Event}}`. Under **More Settings** → **Ecommerce**, tick **Send Ecommerce data** with **Data source** set to **Data Layer**.

**3. Fire it on storekit's events**

Give the tag a **Custom Event** trigger with the event name `^(view_item|add_to_cart|begin_checkout|purchase)$` and **Use regex matching** ticked. These are the event names storekit pushes.

**4. Check and publish**

Check the events in **Preview**, then click **Submit** to publish the container. Purchases show up in your Google Analytics account under **Reports** → **Monetization** → **Ecommerce purchases**.

> [!NOTE]
>
> If your container already has GA4 tags that read storekit's top-level fields (`value`, `transaction_id`, `items`), they keep working. Don't add a second tag for the same events alongside them, or GA4 counts every purchase twice.

## Split App and Website Orders

When your store also has a storekit app, customers in the app use the same ordering pages, so GA4 reports their orders as website orders unless you tag them. storekit pushes `order_channel` (`app` or `web`) and `app_platform` (`ios` or `android`) before your container loads. To use them:

**1. Create the variables**

In your Google Tag Manager account, go to **Variables** → **User-Defined Variables** → **New** → **Data Layer Variable**. Create one with **Data Layer Variable Name** `order_channel` and another with `app_platform`. See Google's [user-defined variables](https://support.google.com/tagmanager/answer/7683362).

**2. Send them with your events**

Open your Google tag and, under **Configuration settings**, add the parameters `order_channel` = `{{order_channel}}` and `app_platform` = `{{app_platform}}`. Every GA4 event from the page then carries them. Publish the container.

**3. Register them in GA4**

In your Google Analytics account, go to **Admin** → **Custom definitions** → **Create custom dimension**, with scope **Event** and event parameter `order_channel`. Repeat for `app_platform`. See Google's [custom dimensions](https://support.google.com/analytics/answer/14240153).

**4. Report on them**

In any report or exploration, add **order\_channel** as a dimension or comparison to see app and website orders, revenue and average order value side by side.

> [!NOTE]
>
> GA4 can't re-tag past events, so the split starts from the day you publish. For history, use the storekit dashboard reports, which already separate app and website orders.

## What the Numbers Mean

| GA4 metric | Comes from |
| - | - |
| **Purchase revenue** | `value` on `purchase`: what the customer paid for the order after discounts |
| **Item revenue** | Each item's `price` × `quantity`. Prices include paid modifiers. Delivery fees, service fees and tips are not items, so item revenue can be lower than purchase revenue |
| **Transaction ID** | The storekit order id. See [Reconciling with Google Analytics](https://storekit.com/docs/guides/integrations/marketing/google-tag-manager.md#reconciling-with-google-analytics) |
| **Item category** | The product's menu category |

> [accordion] Orders are credited to a payment page instead of my campaign
>
> A bank's 3D Secure page or a payment app can show up as the referrer of a purchase. In your Google Analytics account, go to **Admin** → **Data streams** → your stream → **Configure tag settings** → **List unwanted referrals**, and add those domains. See Google's [unwanted referrals](https://support.google.com/analytics/answer/10327750).

> [accordion] My website and storekit ordering pages show as separate sessions
>
> Your website needs the same GA4 measurement ID as your storekit store, either in its own Google tag or through the same GTM container. Then set up cross-domain measurement so the two domains share one session: in your Google Analytics account, open your data stream → **Configure tag settings** → **Configure your domains**. See Google's [cross-domain measurement](https://support.google.com/analytics/answer/10071811).


## Related topics

- [Google Tag Manager](https://storekit.com/docs/guides/integrations/marketing/google-tag-manager.md)
- [All Transactions Report](https://storekit.com/docs/guides/reports/transactions-report.md)
- [Event Tracking](https://storekit.com/docs/privacy-security/event-tracking.md)
- [Setting Up Klaviyo Push Notifications](https://storekit.com/docs/guides/integrations/marketing/klaviyo/push-setup.md)
- [Google Business Profile](https://storekit.com/docs/guides/increasing-sales/google-business-profile.md)


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