> 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/tracking-first-party-data-ga4.md).

# Using first-party data in GA4 for better attribution

Google's [user-provided data collection](https://support.google.com/analytics/answer/14077171?hl=en) enables your Google Analytics property to receive and process hashed first-party customer data.

{% hint style="info" %}
This feature is part of an open beta - it is subject to change, and may have no immediate effect on attribution.
{% endhint %}

This brings benefits similar to **Enhanced Conversions** for Google Ads:

* Better user identification using consenting **Google signed-in users'** data
* **Cross-device attribution** - e.g. user visited on Android phone and then purchased using Chrome (logged in)
* Less reliance on cookies - bypassing 7 day GA cookie limit set by Safari / iOS
* **Demographic / interest** reporting based on first-party data

### How to track first-party data in GA4

There are 2 steps to track first-party data in Google Analytics 4.

1. Open the Littledata app and go to the **Google Analytics 4 destination settings**.\
   Under the **Data customisation** tab, turn on **Send user data**.

   ![](/files/IELHYmokdMrGcLdo5MfJ)
2. In your GA4 property, open **Data collection** and enable **User-provided data collection**.

   ![](/files/VdTllRH0VhlJZTGOOKKC)

After you complete these steps, Littledata will start sending hashed first-party data to your GA4 property.\
\
The data is hashed using the **SHA-256** algorithm.

### How it works?

When you turn on the setting inside your Littledata account, conversion events sent to your Analytics property **will be enriched with hashed first-party data**.

If the user-provided data collection setting inside your Analytics property is not enabled, the **conversion will be processed** but the **first-party data and user\_id will not**.

{% hint style="success" %}
Turn off both the setting in Littledata and the setting in Google Analytics if you don't want to share customer data with Google.
{% endhint %}

This is an example of the data we send to Google Analytics:

```javascript
   "user_id":"7158222333381",
   "user_data":{
      "sha256_email_address":"53b61bf697983d0f07a1e4d6962d81a1b86ccf594d32e9bdfb6ad5e110d48b1c",
      "sha256_phone_number":"f029f7d3dd85b2b7e9b657792d168ab92c48c4363634c59187d5a2dd3279188f",
      "address":{
         "sha256_first_name":"1b99f3740501eaef26b5a0a3958b8fe9e81b822981a414d510b1e5b139348cdf",
         "sha256_last_name":"e75be31f77b4aae647f4e0b4233bb5cf3b67384434b76ed36f6ff723f79ef1ce",
         "sha256_street":"4249a5b864b0f3382e9d29c6fd98065fdea6a0ec263fa691842e7e52787aa3e6",
         "city":"3eef36f440a655f87ec46c3e7e4a61427d3c3549b53c33e34f65fa78ad9ee31d",
         "region":"124e0b7201b0388d7c07f43194b9645d162b77005b66fef7283c689a69ff7c56",
         "postal_code":"92c7d71b95dc6540fc58e891dbe649fe72ae5e93b5f42fd7fbdeefe6cef3e51d",
         "country":"884129b7691d98f541650f9974a034323677ebe4e1c3bd71ebf5d43cdf118acc"
      }
   }
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.littledata.io/integrations/shopify-to-google-analytics/tracking-first-party-data-ga4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
