> For the complete documentation index, see [llms.txt](https://help.littledata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.littledata.io/integrations/shopify-to-google-analytics/how-it-works-shopify-to-ga4.md).

# How it works: Shopify to Google Analytics

The events and parameters Littledata sends to Google Analytics 4, from the browser and from Littledata's servers, and how session enrichment works.

This page explains what Littledata sends to Google Analytics 4 (GA4). Use it to see which events you get, which parameters come with them, and which settings change how orders are attributed.

<figure><img src="https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2Fgit-blob-ab4ead720decff02f47aef7185ab6fe6d0aeece8%2Fconnection-google-analytics.png?alt=media" alt="Diagram of browser, server, metafield and channel data flowing through Littledata to Google Analytics"><figcaption></figcaption></figure>

Littledata uses a mix of browser (client-side) tracking and [server-side tracking](https://help.littledata.io/get-started/how-server-side-tracking-works). Browsing events come from a script on your store. Cart, checkout and order events are sent from Littledata's servers.

#### What you can track

All the events below are on by default. You can turn them off during setup, or later in the Littledata app: find the Google Analytics 4 card, click the **⋯** menu on its card, choose **Settings** and open the **Event Editor** tab.

#### **Client-side events**

Littledata's script on your store sends these events from the visitor's browser.

| Event name            | Description                                        |
| --------------------- | -------------------------------------------------- |
| page\_view            | A visitor views a page                             |
| view\_item\_list      | A visitor sees a product in a product list         |
| select\_item          | A visitor clicks a product in a product list       |
| view\_item            | A visitor views a product page                     |
| select\_content       | A visitor clicks a product image on a product page |
| share                 | A visitor shares a product                         |
| view\_cart            | A visitor views the cart page                      |
| view\_search\_results | A visitor views search results                     |
| sign\_up              | A visitor creates an account on your store         |
| login                 | A visitor logs in to an existing account           |

See [Tracking product list views and clicks](https://help.littledata.io/integrations/shopify-to-google-analytics/tracking-product-list-views-and-clicks) for more on list events.

#### **Server-side events**

[Littledata's servers](https://help.littledata.io/get-started/how-server-side-tracking-works) receive these events from Shopify and send them to GA4.

| Event               | Description                                                                                                                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| add\_to\_cart       | A visitor adds a product to the cart                                                                                                                                                                     |
| remove\_from\_cart  | A visitor removes a product from the cart                                                                                                                                                                |
| begin\_checkout     | A customer [starts checkout](https://help.littledata.io/integrations/shopify-to-google-analytics/checkout-funnel-steps)                                                                                  |
| add\_shipping\_info | A customer adds shipping information in checkout                                                                                                                                                         |
| add\_payment\_info  | A customer adds payment information in checkout                                                                                                                                                          |
| purchase            | A customer places an order. Shopify POS orders are excluded by default. The transaction ID is the [Shopify order name](https://help.littledata.io/advanced/developer/data-pipeline-settings) by default. |
| refund              | An order is refunded                                                                                                                                                                                     |
| upsell              | A customer accepts a post-purchase upsell offer                                                                                                                                                          |

{% hint style="info" %}
Littledata waits about 60 seconds after an order is created before processing it. This gives other apps time to update the order's tags or status first.
{% endhint %}

#### Checkout steps

Littledata sends checkout steps to GA4 automatically, so you can report on checkout conversion without extra setup. This works for Shopify's checkout (including Checkout Extensibility) and the [Recharge checkout](https://help.littledata.io/sources/recharge/how-it-works-recharge-to-google-analytics-connection).

The checkout journey starts when the customer clicks the checkout button.

| Checkout step              | GA4 event           |
| -------------------------- | ------------------- |
| Checkout started           | begin\_checkout     |
| Shipping information added | add\_shipping\_info |
| Payment information added  | add\_payment\_info  |
| Order placed               | purchase            |

See [Tracking Shopify checkout steps in Google Analytics](https://help.littledata.io/integrations/shopify-to-google-analytics/checkout-funnel-steps) for details.

#### Custom parameters

Littledata adds these parameters to the events it sends from its servers.

When you connect GA4, Littledata creates custom dimensions for `shopify_customer_id_ld`, `lifetime_revenue_ld`, `purchase_count_ld`, `last_transaction_date_ld`, `payment_gateway_ld`, `affiliation` and `app_name` in your property. See [Custom dimensions for calculating customer lifetime value](https://help.littledata.io/google-analytics/conversions/customer-lifetime-value-google-analytics).

**User-scoped parameters**

The `_ld` user properties are set with the purchase and upsell events.

| Parameter                   | Description                                                                                                                                                                                               |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| user\_id                    | The Shopify customer ID. Only sent when **Send user data** is on. See [Using first-party data in GA4](https://help.littledata.io/integrations/shopify-to-google-analytics/tracking-first-party-data-ga4). |
| shopify\_customer\_id\_ld   | The customer's ID in Shopify                                                                                                                                                                              |
| lifetime\_revenue\_ld       | Total amount the customer has spent in your store, from Shopify                                                                                                                                           |
| purchase\_count\_ld         | Number of orders the customer has placed, from Shopify                                                                                                                                                    |
| last\_transaction\_date\_ld | Date of the order, in `YYYY-MM-DD` format                                                                                                                                                                 |
| payment\_gateway\_ld        | Payment gateway used for the order                                                                                                                                                                        |

**Event-scoped parameters**

| Parameter               | Description                                                                                                                                                                                                | Sent with                                  |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| littledata\_client\_id  | The GA client ID (the cookie identifier Google uses to group events by user)                                                                                                                               | Server-side events                         |
| store\_name             | Your store's `.myshopify.com` domain. Useful when several stores send data to one GA4 property.                                                                                                            | Cart, checkout, purchase and refund events |
| affiliation             | A comma-separated list of order tags. Untagged orders use `Shopify`.                                                                                                                                       | Purchase, upsell and refund events         |
| app\_name               | The app that created the order (falls back to the app ID)                                                                                                                                                  | Purchase, upsell and refund events         |
| market\_handle          | The handle of the Shopify Market. Only sent when the event belongs to a market.                                                                                                                            | Server-side events                         |
| market\_id              | The Shopify Market ID. Only sent when the event belongs to a market.                                                                                                                                       | Server-side events                         |
| profit\_value           | The estimated profit of the order. Only sent when [Profit Signal](https://help.littledata.io/sources/profit-signal/how-to-use-profit-signal) is on. Register it as a custom metric in GA4 to report on it. | Purchase and upsell events                 |
| profit\_margin\_applied | The profit margin used for the calculation (for example `0.4` for 40%). Only sent with `profit_value`.                                                                                                     | Purchase and upsell events                 |

**Market parameters**

With `market_handle` and `market_id` you can filter and segment reports by Shopify Market. For example, compare conversion rates or revenue between markets, or build GA4 audiences for one region. Register `market_handle` as a custom dimension in GA4 to use it in your reports. This needs Shopify Markets to be active on your store, but no extra setup in Littledata.

#### Session enrichment

Session enrichment settings change how Littledata attributes orders in GA4. To find them, open the Littledata app, find the Google Analytics 4 card, click the **⋯** menu on its card, choose **Settings** and open the **Session enrichment** tab.

| Setting                                   | Default  | What it does                                                                                                                                                                                                                                        |
| ----------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attribution boost                         | On       | Improves order attribution by matching purchases to existing session data, such as UTM parameters.                                                                                                                                                  |
| Attribution boost for recurring purchases | Off      | Recurring (subscription) purchases keep the UTM parameters of the first order, so campaign attribution stays consistent.                                                                                                                            |
| Source and medium customization           | No rules | Lets you create rules that set the source, medium or campaign of orders based on order details. See [Source/Medium customization](https://help.littledata.io/integrations/shopify-to-google-analytics/source-medium-customization-payment-gateway). |

{% hint style="info" %}
If you have subscriptions and want recurring orders credited to the campaign that brought in the first order, turn on **Attribution boost for recurring purchases**.
{% endhint %}

For a more detailed schema of events and parameters, contact <help@littledata.io>.

#### Related articles

* [Littledata to Google Analytics installation guide](https://help.littledata.io/integrations/shopify-to-google-analytics/littledata-shopify-install-guide)
* [Tracking Shopify checkout steps in Google Analytics](https://help.littledata.io/integrations/shopify-to-google-analytics/checkout-funnel-steps)
* [Using first-party data in GA4 for better attribution](https://help.littledata.io/integrations/shopify-to-google-analytics/tracking-first-party-data-ga4)
* [Source/Medium customization](https://help.littledata.io/integrations/shopify-to-google-analytics/source-medium-customization-payment-gateway)
* [Changing the data pipeline settings](https://help.littledata.io/advanced/developer/data-pipeline-settings)
