Hello, I’m still stuck sending backend events to G...
# support
b
Hello, I’m still stuck sending backend events to GA4 through Rudderstack Problem 1: client_id needs to be generated by gtag.js which is fine, I will store this information with my user as soon as they sign up. But what I see is that no matter where I set it in my payload it gets overridden by rudderId:
Copy code
curl -u WRITE_KEY: -X POST https://track.mydomain.com/v1/track \
--header "Content-Type: application/json" \
--data-raw '{
    "client_id": "1062148654.1696677236",
    "context": {
        "ip": "XXXXX"
    },
    "event": "Purchase completed",
    "messageId": "97e640c4-b430-4e47-b6e7-fb1e87028654",
    "properties": {
        "body_length": 160,
        "category": "real-estate",
        "id": 69319,
        "market": "ma",
        "payment_method": "card",
        "title_length": 16,
        "type": "text",
        "vas_local_value": 250,
        "vas_type": "urgent-question",
        "vas_value": 25
    },
    "type": "track",
    "userId": "email@gmail.com"
}'
This results into RS seeing this payload:
Copy code
{
  "context": {
    "ip": "XXXXX"
  },
  "event": "Purchase completed",
  "messageId": "97e640c4-b430-4e47-b6e7-fb1e87028654",
  "properties": {
    "body_length": 160,
    "category": "real-estate",
    "id": 69319,
    "market": "ma",
    "payment_method": "card",
    "title_length": 16,
    "type": "text",
    "vas_local_value": 250,
    "vas_type": "urgent-question",
    "vas_value": 25
  },
  "rudderId": "b03abccb-e0b5-46e7-a1fc-82e04b988420",
  "type": "track",
  "userId": "email@gmail.com"
}
and on GA4 this is what gets sent:
Copy code
{
  "body": {
    "XML": {},
    "FORM": {},
    "JSON": {
      "events": [
        {
          "name": "Purchase_completed",
          "params": {
            "id": 69319,
            "type": "text",
            "market": "ma",
            "category": "real-estate",
            "vas_type": "urgent-question",
            "vas_value": 25,
            "body_length": 160,
            "title_length": 16,
            "payment_method": "card",
            "vas_local_value": 250,
            "engagement_time_msec": 1
          }
        }
      ],
      "user_id": "email@gmail.com",
      "client_id": "b03abccb-e0b5-46e7-a1fc-82e04b988420",
      "timestamp_micros": 1702996946000000
    },
    "JSON_ARRAY": {}
  },
  "type": "REST",
  "files": {},
  "method": "POST",
  "params": {
    "api_secret": "XXXXXX",
    "measurement_id": "G-XXXXXXX"
  },
  "userId": "",
  "headers": {
    "HOST": "www.google-analytics.com",
    "Content-Type": "application/json"
  },
  "version": "1",
  "endpoint": "https://www.google-analytics.com/mp/collect"
}
As you can see client_id gets the value of rudderId. The idea of client_id is for Google to know which user did what action on Google ads as well, so they know how to retarget and how to optimize for acquisition for Purchase. But rudderId hijacking that value defies the purpose of cross platform tracking. Finally, the event above doesn’t show up on GA4 at all, I’m not sure why is that and what am I doing wrong?
m
Hey There! 👋 Your message has been received by the RudderStack team. 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.
Hi Aymane, you can set the client Id as the rudderstack anonymousId.
Copy code
`rudderanalytics.setAnonymousId(<client_id>); `⁣
b
I’m using HTTP Api, Let me try setting it in the payload
It worked, thanks! still I can’t see the event on the Real time dashboard I’ll call it a day and check tomorrow. But please share any tips. I’m using cloud mode
m
⁣You should see the events on the live-events dashboard, though there is generally a few seconds delay.
b
Sure on Rudderstack it’s all good. What I meant is on the Real time dashboard on GA4.
m
Can you try sending a simple page event?
b
Done. The event is sent successfully. But didn’t show up on GA4 Real time
m
Can you provide the workspaceId?
b
Yes
gmail-aymane.sennoussi
@shy-kite-21035 Let me know if you need any other information. I’ve been stuck here for 2 days now
m
Hey sorry Aymane, I was OOO for a few days. Looking into this.
I still cannot find your workspace. Can you provide the source or destination id?
I am planning to test this out in the following way. I will use your source to send my events and see if they are sent correctly. This should help us figure out if this is a destination issue or a RudderStack issue.