Reputation: 49590
In my situation, some conversion events happen offline. For example, user visits a website, then books a meeting via calendly (I generate a user_id
based on the email provided and save to CRM), then at some later point (maybe a few weeks later), signs a contract (i.e. makes a purchase).
I'm currently testing sending the purchase
event via Measurement protocol, and because I don't have the original client_id
, I figured I could just use the user_id
as the client_id
.
The problem is that GA4 shows the event and the value amount, but not the user - i.e. 1 purchase
event, but 0 users.
Here's the payload for the Measurement Protocol that I'm sending:
{
client_id: userId,
user_id: userId,
events: [
{
name: "purchase",
params: {
value: amount,
currency: "CAD",
transactionId: transactionId
}
}
]
}
(userId
, transactionId
and amount
are just variables in my code that supply the values)
The client_id
seems to be meant to identify a device that the user is using. For offline events where user_id
is used, I figured the "device" could be whatever, so I reused the used_id
as the client_id
.
Capturing the original cliend_id
is non-trivial, and seems semantically wrong too (what if the user accessed the site through multiple devices - which client_id
is the one I should be using to send an offline event?)
Question - why are users not being reported or shown in GA4?
For reference, here's what I found about the need to send a client_id
that's already been used:
In order for an event to be valid, it must have a client_id that has already been used to send an event from gtag.js. You will need to capture this ID client-side and include it in your call to the Measurement Protocol. In send an event to your property, we use "client_id" as the client_id. You will need to replace this with a real client_id that comes from gtag.js.
On the other hand, it says here:
The second option for sending CRM data to Google Analytics is to use the measurement protocol. With this option, you can use the Google Analytics generated client Id or your own user Id as the lookup key to join your data with Google Analytics data.
Upvotes: 3
Views: 949