# Google Analytics Client ID

## **Why Client ID?**

claimr can automatically retrieve the Google Analytics Client ID for more accurate user tracking within your widget. This provides a more complete picture of user behavior in your Google Analytics 4 reports.

* **Improved cross-session tracking:** Accurately track user behavior even if they close and reopen the browser or switch devices.
* **More accurate user counts:** Avoid counting the same user multiple times.
* **Richer data in Google Analytics:** Get a complete picture of user engagement within your claimr widget.

## **Automatic Client ID retrieval (recommended)**

Once you integrated your claimr widget with Google Analytics 4 (using either the `data-ga4` attribute in your embed script or the `ga4` URL parameter, as described in [google-analytics-integration](https://claimr-io.gitbook.io/claimr-help-center/widget/claimr-widget-integrations/google-analytics-integration "mention") article), claimr usually finds the Client ID automatically.

**How it works:** claimr checks for the standard Google Analytics cookie (`_ga`). This cookie contains the Client ID in the format `GA1.1.USER_ID`. claimr extracts the `USER_ID` portion and uses it for tracking. You generally *do not* need to add any extra code.

## **Manual Client ID passing (alternative)**

If the automatic retrieval doesn't work, or if you need more control, you can manually pass the Client ID using a URL parameter:

* Add `?ga4cid=USER_ID` to your claimr campaign URL, replacing `USER_ID` with the actual Client ID from the `_ga` cookie.

**Example**

```
https://campaign?ga4cid=123456789.987654321
```

Replace `123456789.987654321` with the actual Client ID and `https://campaign` with your base campaign URL).

## **Verification**

To check the integration, you can use tools from Google Analytics.
