Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Client ID snippet to Gtag code example #5041

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

bobbyatsegment
Copy link
Contributor

Proposed changes

On sending events from both browser and server, GA4 Web docs mention:

With Google Analytics 4 Web, events are sent from the browser to GA4. If you use Segment’s Google Analytics 4 Cloud destination to send events through the API and tie data between client-side and server-side, you need to pass the same Client ID from the browser and the server. To do this, fetch the Gtag-generated clientId on the web client and pass it to Segment as a property. For more information, see Google Analytics 4 destination: User Identification on the next steps.

However, the GA4 Cloud Mode docs' section on using Gtag.js and GA4 Cloud mode do not show an example of retrieving the Client ID with Gtag, nor does it directly state that the user identification between the two implementations should be the same.

Modified the code example to demonstrate this, along with directly stating:
Additionally, client_id must also align between client-side and server-side events in order to deduplicate user counts in GA4 (unless User-ID is used as the basis for user identification).

Merge timing

Related issues (optional)

@bobbyatsegment bobbyatsegment marked this pull request as ready for review July 26, 2023 17:40
@bobbyatsegment bobbyatsegment requested a review from a team as a code owner July 26, 2023 17:40
@bobbyatsegment bobbyatsegment requested review from forstisabella and removed request for a team July 26, 2023 17:40
@forstisabella forstisabella merged commit 0a12b80 into develop Jul 26, 2023
@forstisabella forstisabella deleted the bobbyatsegment-patch-13 branch July 26, 2023 22:41
@github-actions
Copy link
Contributor

Thank you for your contribution! Your pull request is merged, but may take a day or two to appear on the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants