如何在 Mixpanels 的 JQL 中查询事件的多个属性?

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

function main (){ return Events({ from_date: "2023-04-06", to_date: "2023-05-26", event_selectors: [{event: "FeedExited"}, {event: "GameExited"}, {event: "DiscoveryExited"}] }) .filter(function(event){return event.properties.UserName && event.properties.InviteCode}) .groupBy(["properties.UserName", "properties.InviteCode"], mixpanel.reducer.count()); }

尝试了上面的代码,但它只返回三个事件的计数总和。

mixpanel
1个回答
0
投票

如果我理解正确的话,你想区分这些事件。 在这里,我添加了事件名称作为分组标准的一部分,这样您将获得每个“用户名”和“邀请代码”的每个事件的计数。


function main() {
    return Events({
        from_date: "2023-04-06",
        to_date: "2023-05-26",
        event_selectors: [
            {event: "FeedExited"},
            {event: "GameExited"},
            {event: "DiscoveryExited"}
        ]
    })
    .filter(function(event) {
        return event.properties.UserName && event.properties.InviteCode;
    })
    .groupBy(
        ["name", "properties.UserName", "properties.InviteCode"],
        mixpanel.reducer.count()
    );
}

这样你就可以得到像这样的json数据:

[
  {"key": ["FeedExited", "user123", "codeABC"], "value": 5},
  {"key": ["GameExited", "user123", "codeABC"], "value": 3},
  {"key": ["DiscoveryExited", "user456", "codeXYZ"], "value": 7}
]
© www.soinside.com 2019 - 2024. All rights reserved.