Hi all, I'm setting up a GA4 destination in additi...
# support
a
Hi all, I'm setting up a GA4 destination in addition to GA Universal and it's working well. However I need to send the GA client_id from the _ga cookie through to GA4 instead of the Rudderstack userId. I achieved this for GA Universal by adding the Google Analytics clientId from the cookie into each request as part of the integrations object. However for GA4 the docs say to use the GA4 client_id Field Identifier setting to identify which field in the payload GA4 should take the clientId. I've tried: clientId, integrations.Google Analytics.clientId, integrations."Google Analytics".clientId but nothing seems to work. Note I'm using GA4 in hybrid mode.
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
a
CleanShot 2023-02-09 at 16.56.43@2x.png
Perhaps this only works in cloud mode and these page events are being sent in device mode? How can I send the client_id through to GA4 for events on the website when using hybrid mode?
b
@alert-vegetable-59655 for hybrid mode page events is sent through device mode and rest of the calls are sent through cloud mode. now coming to client_id for page call ga4 sdk will automatically send client_id and you can see it as
cid
param in payload and for rest of the events rudderstack is fetching the client_id and set it inside integrationsObj. so that in cloud mode event have client_id.
a
OK thanks Mihir. So if I want to send the GA client_id from the cookie as the client_id, and not use the Rudderstack userID (as is happening now), could you share an example of what I should set that will work for both device and cloud mode?
It's a bit strange, because in the GA debugger I do see the client_id as the cid. However in Live Report I see the Rudderstack userId. I don't even see the Rudderstack userID in the GA4 request, so not sure how it's getting there!
b
i believe for ga4 client_id and userId both are different for device mode userId is equal to
uid
parameter where as client_id is equal to
cid
parameter
cid
is something which ga4 generates automatically where as you can populate
uid
by sending
userId
in the payload
a
OK thanks. So just to be clear, the only way to send client_id as user_id to GA4 is to set the userId = client_id in Rudderstack payload? This isn't ideal as I don't want to send it as the userId (this might become a system UID in the future). But in order for GA4 to track a user correctly across subdomains / iFrames etc that don't have Rudderstack, the user_id is GA4 needs to be the client_id as that's the default behaviour of GA. This is also not the behaviour of GA Universal, which takes it's id from the integrations object so it can be set as the clientId without change the userId
b
So just to be clear, the only way to send client_id as user_id to GA4 is to set the userId = client_id in Rudderstack payload? yes, as of now that's the only way
a
OK thanks Mihir, you've been a great help. It would be great, as a feature request, to be able to define the GA4 client_id in integrations or as an externalID so that it's used by GA4 as the userId, in exactly the way it works for GA Universal.
b
are you talking about device mode??