使用原始导出API下载Mixpanel事件并根据distinct_id进行过滤

问题描述 投票:0回答:1

我在 Mixpanel 中有一些事件,我可以使用原始导出 API 成功下载这些事件。在此示例中,我正在过滤“城市”字段。这有效。

    import requests
    
    url = "https://data.mixpanel.com/api/2.0/export?project_id=<project id>&from_date=2023-11-16&to_date=2023-11-16&limit=10&where=properties%5B%22%24city%22%5D%20%3D%3D%20%22San%20Antonio%22"

    
    headers = {
        "accept": "text/plain",
        "authorization": "Basic <token>"
    }
    
    response = requests.get(url, headers=headers)
    
    print(response.text)

但是,当我尝试过滤 unique_id 属性,搜索我知道具有匹配事件的值时,我得到 0 个返回的事件(状态代码 200)。

    import requests
    
    url = "https://data.mixpanel.com/api/2.0/export?project_id=<project id>&from_date=2023-11-16&to_date=2023-11-16&limit=10&where=properties%5B%22distinct_id%22%5D%20%3D%3D%20%22fa1bd247-b252-498a-bace-6b31f876f09%22"

    
    headers = {
        "accept": "text/plain",
        "authorization": "Basic <token>"
    }
    
    response = requests.get(url, headers=headers)
    
    print(response.text)

有谁知道为什么所有字段中,distinct_id 不能用于过滤?我是不是错过了什么?

谢谢。

注意:我也可以过滤其他 uuid 字符串属性,因此格式或长度似乎不是问题。

mixpanel
1个回答
0
投票

根据Mixpanel支持团队的反馈,distinct_id是一个特殊字段,因此需要在其前面加上'$'才能查询,即使实际字段的名称中没有。

© www.soinside.com 2019 - 2024. All rights reserved.