> For the complete documentation index, see [llms.txt](https://docs.claimr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.claimr.io/widget/claimr-widget-integrations/google-analytics-client-id.md).

# 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](/widget/claimr-widget-integrations/google-analytics-integration.md) 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.


---

# 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://docs.claimr.io/widget/claimr-widget-integrations/google-analytics-client-id.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.
