Skip to content

Segmentation seems to be broken - countly Unity SDK. #5132

Closed
@ajeets1978

Description

@ajeets1978

I am sending an event with segmentation like following

if (data.InstallReferrer != null)
segment.Add("referrer", data.InstallReferrer.Trim());

if (data.ReferrerClickTime != null)
segment.Add("click_timestamp", data.ReferrerClickTime.Millisecond);

if (data.InstallBeginTime != null)
segment.Add("begin_timestamp", data.InstallBeginTime.Millisecond);

if(data.InstallBeginServerTime != null)
segment.Add("begin_server_time", data.InstallBeginServerTime.Millisecond);
if (data.ReferrerClickServerTime != null)
segment.Add("server_click_time", data.ReferrerClickServerTime.Millisecond);
if (data.InstallVersion != null)
segment.Add("install_version", data.InstallVersion);

segment.Add("android_id", SystemInfo.deviceUniqueIdentifier);
await Countly.Instance.Events.RecordEventAsync("_install", segmentation: segment);

Enabled: Post, so its using post method.

Expected

{
"app_key": "KVdfbLC6edbb3VkdZSgfxRKd6eR-9ODd",
"device_id": "7d76abb74d7c926c2b683353d139b145f62578f5",
"sdk_name": "csharp-unity-editor",
"sdk_version": "20.11.5",
"timestamp": 1632727509046,
"hour": 17,
"dow": 1,
"tz": "600",
"events": "[\r\n {\r\n "key": "_install",\r\n "count": 1,\r\n "sum": 0.0,\r\n "segmentation": {\r\n "android_id": "7d76abb74d7c926c2b683353d139b145f62578f5",\r\n "device_type": "Desktop",\r\n "device_name": "DESKTOP-EC95NPV",\r\n "device_model": "B450 AORUS PRO WIFI (Gigabyte Technology Co., Ltd.)",\r\n "device_os": "Windows 10 (10.0.19043) 64bit",\r\n "screen_width": 387,\r\n "screen_height": 688,\r\n "screen_dpi": 96,\r\n "app_version": "1.0",\r\n "platform": 7,\r\n "adid": "Test-Advertising-ID"\r\n },\r\n "timestamp": 1632727509030,\r\n "hour": 17,\r\n "dow": 1\r\n }\r\n]"
}

Actual

{
"t": "0",
"av": "0.13",
"rr": "0",
"tz": "600",
"dow": "1",
"adid": "admob",\r\n "click_timestamp": 22,\r\n "begin_timestamp": 22,\r\n "begin_server_time": 22,\r\n "server_click_time": 22,\r\n "install_version": "1.0",\r\n "android_id": "7d76abb74d7c926c2b683353d139b145f62578f5"\r\n },\r\n "timestamp": 1714348407031,\r\n "hour": 9,\r\n "dow": 1\r\n }\r\n]",
"hour": "9",
"events": "[\r\n {\r\n "key": "_install",\r\n "count": 1,\r\n "sum": 0.0,\r\n "segmentation": {\r\n "referrer": "utm_source=google",
"app_key": "KVdfbLC6edbb3VkdZSgfxRKd6eR-9ODd",
"sdk_name": "csharp-unity-editor",
"utm_term": "1",
"device_id": "KVdfbLC6edbb3VkdZSgfxRKd6eR-9ODd",
"timestamp": "1714348469052",
"ip_address": "101.117.0.2",
"utm_medium": "cpc",
"checksum256": "8ad1d96fa70303a855c7774e72e2a1cf7e45a432d17633e6daa6bf27e17f1883",
"sdk_version": "23.12.1",
"utm_content": "2",
"utm_campaign": "3"
}

It is breaking segmentation as random separate keys. In logs I can see the body params

body: app_key=KVdfbLC6edbb3VkdZSgfxRKd6eR-9ODd&device_id=KVdfbLC6edbb3VkdZSgfxRKd6eR-9ODd&t=0&sdk_name=csharp-unity-editor&sdk_version=23.12.1&av=0.13&timestamp=1714348469052&hour=9&dow=1&tz=600&events=[%0D%0A%20%20%7B%0D%0A%20%20%20%20%22key%22:%20%22_install%22,%0D%0A%20%20%20%20%22count%22:%201,%0D%0A%20%20%20%20%22sum%22:%200.0,%0D%0A%20%20%20%20%22segmentation%22:%20%7B%0D%0A%20%20%20%20%20%20%22referrer%22:%20%22utm_source=google&utm_medium=cpc&utm_term=1&utm_content=2&utm_campaign=3&adid=admob%22,%0D%0A%20%20%20%20%20%20%22click_timestamp%22:%2022,%0D%0A%20%20%20%20%20%20%22begin_timestamp%22:%2022,%0D%0A%20%20%20%20%20%20%22begin_server_time%22:%2022,%0D%0A%20%20%20%20%20%20%22server_click_time%22:%2022,%0D%0A%20%20%20%20%20%20%22install_version%22:%20%221.0%22,%0D%0A%20%20%20%20%20%20%22android_id%22:%20%227d76abb74d7c926c2b683353d139b145f62578f5%22%0D%0A%20%20%20%20%7D,%0D%0A%20%20%20%20%22timestamp%22:%201714348407031,%0D%0A%20%20%20%20%22hour%22:%209,%0D%0A%20%20%20%20%22dow%22:%201%0D%0A%20%20%7D%0D%0A]&rr=0 response: StatusCode: 200, IsSuccess: True, ErrorMessage: , Data: {"result":{"status":1,"message":"success"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions