Skip to content

Commit 41c9ae9

Browse files
authored
Merge pull request #6096 from segmentio/courtneyga-patch-13
Added required information for using Gtag via server
2 parents 3f7245f + bdc3de3 commit 41c9ae9

File tree

1 file changed

+1
-1
lines changed
  • src/connections/destinations/catalog/actions-google-analytics-4-web

1 file changed

+1
-1
lines changed

src/connections/destinations/catalog/actions-google-analytics-4-web/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ The Google Analytics 4 debug mode, [DebugView](https://support.google.com/analyt
133133
134134
### Send events from both the browser and the server
135135
136-
With Google Analytics 4 Web, events are sent from the browser (client-side) to GA4. If you use Segment’s [Google Analytics 4 Cloud destination](/docs/connections/destinations/catalog/actions-google-analytics-4/#benefits-of-google-analytics-4-cloud) to send events through the Measurement Protocol API and want to tie data between client-side and server-side, you need to pass the same Client ID from the browser and the server for GA4 to merge events around a distinct user, and if you want the server-side event to be tied to the client-side session, you must pass the session_id in the server side event.
136+
With Google Analytics 4 Web, events are sent from the browser to GA4. If you use Segment’s [Google Analytics 4 Cloud destination](/docs/connections/destinations/catalog/actions-google-analytics-4/#benefits-of-google-analytics-4-cloud) 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](/docs/connections/destinations/catalog/actions-google-analytics-4/#user-identification) on the next steps. Additionally, when using Gtag, Google generates a session_id and session_number when a session begins. The session_id and session_number generated on the client can be passed as Event Parameters to stitch events sent through the API with the same session that was collected client-side, see [Using Gtagjs and Google Analytics 4 Cloud Destination](/docs/connections/destinations/catalog/actions-google-analytics-4/#using-gtagjs-and-google-analytics-4-cloud-destination) for more information and an example.
137137
138138
The client_id and the session_id are both cookies stored in the user browser. You can use [Google gtag get commands](https://developers.google.com/tag-platform/gtagjs/reference#get){:target=”_blank”} or other cookie methods to parse these values from the _ga cookie and _ga_measurementId cookie:
139139
- If your _ga cookie is GA1.1.1783165678.1701112990 then 1783165678.1701112990 is your client_id

0 commit comments

Comments
 (0)