Hi team, I’m setting the integrations between Rudd...
# support
a
Hi team, I’m setting the integrations between Rudder Stack Cloud and GA, however I did not see any events sent to GA4 except for the page_view. Can someone help review it?
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.
s
You need it in device mode to send all the data.
(I’m not with rudderstack but ran into the same issue)
a
Thanks! Though I changed it but nothing happened
b
have you enabled debug mode toggle from UI configuration for cloud mode?
a
Hi @bulky-breakfast-19942, No I disabled it
b
can you share a transformed GA4 payload with me from live events
a
Copy code
{
  "body": {
    "XML": {},
    "FORM": {},
    "JSON": {
      "events": [
        {
          "name": "[Gridly]_Open_General_Setting",
          "params": {
            "email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
            "userName": "Thy Nguyen",
            "companyId": "10299292172812288",
            "SESSION_ID": "\"bc1e45af-d3be-4bf0-8371-a95c43d1a938\"",
            "page_title": "INTG | my company | Gridly",
            "session_id": 1685693133384,
            "companyName": "my company",
            "workspaceId": "6946",
            "page_location": "<https://integration.gridly.com/projects/6946>",
            "page_referrer": "$direct",
            "engagement_time_msec": 1
          }
        }
      ],
      "user_id": "9234933867667456",
      "client_id": "7aa1e2a4-b111-447a-a445-2fc2ecc8b56f",
      "timestamp_micros": 1685693140000000
    },
    "JSON_ARRAY": {}
  },
  "type": "REST",
  "files": {},
  "method": "POST",
  "params": {
    "api_secret": "wdxeqdKtTXir4NJaTbcB0g",
    "measurement_id": "G-3XWM4FJKLW"
  },
  "userId": "",
  "headers": {
    "HOST": "<http://www.google-analytics.com|www.google-analytics.com>",
    "Content-Type": "application/json"
  },
  "version": "1",
  "endpoint": "<https://www.google-analytics.com/mp/collect>"
}
b
issue is with event name, event name must start with alphabetic character
GA4 drops event if event name starts without an alphabetic character
Refer below doc for more info about GA4 custom event naming convention https://support.google.com/analytics/answer/13316687?hl=en
Only letters, numbers, and underscores are allowed in event name
a
Can I write a transform script to change the event name?
b
yes, you can
make sure you are following GA4 event naming rules
a
Thanks @bulky-breakfast-19942, I tried to run this transformation script
Copy code
function transformEvent(event) {
  if (event.properties) {
    for (const key in event.properties) {
      if (event.properties.hasOwnProperty(key)) {
        const value = event.properties[key];
        if (typeof value === 'string' && value.startsWith('[Gridly]')) {
          event.properties[key] = 'Gridly_' + value.substring(8);
        }
      }
    }
  }
  return event;
}
but received output:
Copy code
Expected one of transformEvent,transformBatch. Found
Can you help me review the script? I’m not very familiar with Javascript
b
you want to convert
[Gridly]_Open_General_Setting
to
Gridly_Open_General_Setting
right?
a
Yes
b
export function transformEvent(event, metadata) {
if(event.event.includes('[Gridly]')){
const name = event.event;
event.event = 'Gridly_' + name.substring(9);
}
return event;
}
try this
❤️ 1
a
Many thanks, it worked!