hajeonghun / electron-google-analytics4

electron-google-analytics4
17 stars 2 forks source link

Question: Count users through measurement protocol #5

Closed megahertz closed 1 year ago

megahertz commented 1 year ago

Hi @hajeonghun.

Event sending works fine (it's visible in the Realtime section of Analytics). But in the section "Users in last 30 minutes" there is always "0" value. Maybe an app should send a specific event to make GA4 calculate users? There was no such an issue previously with UA measurement protocol. Sure, that's not related to this library directly, but maybe somebody already solved such an issue.

Here's an example of request my app sends to GA4:

{
  "client_id": "<uuid>",
  "user_id": "<uuid>",
  "user_properties": {
    "app_name": {
      "value": "MyApp"
    },
    "app_version": {
      "value": "1.0.0"
    },
    "arch": {
      "value": "x64"
    },
    "os": {
      "value": "Linux"
    },
    "os_version": {
      "value": "6.2.13"
    }
  },
  "events": [
    {
      "name": "login",
      "params": {
        "session_id": "<uuid>",
        "method": "login_with_token"
      }
    }
  ]
}
megahertz commented 1 year ago

Found an answer. Some events liks page_view should contain engagement_time_msec parameter. In that case this user is counted.