Piwik 按自定义变量过滤图表

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

在 piwik 中,是否可以根据跟踪器中的自定义变量过滤访客图表?我想在第一个自定义变量槽中显示所有带有

70
值的访问的演变图。我试过这个电话

index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=VisitsSummary&apiAction=get&token_auth=anonymous&graphType=evolution&period=day&date=2012-01-01,2012-07-10&width=500&height=250&filter_column=custom_var_v1&filter_pattern=70

但是得到了

该图没有数据。

当我删除

filter_pattern
时,我会得到一张图表。我检查了数据库中的
piwik_log_visit
表,我有访问记录的值。

php mysql graph analytics matomo
2个回答
0
投票

使用 custom_var_v1 = 70 创建一个分段(我建议将其设置为预存档,以防流量很大)。


0
投票

当您使用过滤时:

您正在使用filter_column和filter_pattern,它们是全局Piwik API过滤器。但您必须确保自定义变量数据存在于您正在查询的报告中。默认情况下,VisitsSummary.get 方法可能不包含自定义变量数据。

根据自定义变量查询数据时,请使用 CustomVariables.getCustomVariables API 方法,而不是VisitsSummary.get

您的查询将如下所示:

index.php?module=API&method=CustomVariables.getCustomVariables&idSite=1&period=day&date=2012-01-01,2012-07-10&token_auth=anonymous&filter_column=custom_var_v1&filter_pattern=70


尝试细分:

尝试分段而不是过滤。分段参数允许您按各种指标(包括自定义变量)对数据进行分段。 尝试将此段参数添加到您的查询中:

&段=custom_var_v1==70

您的查询将如下所示:

index.php?module=API&method=CustomVariables.getCustomVariables&idSite=1&period=day&date=2012-01-01,2012-07-10&token_auth=anonymous&segment=custom_var_v1==70

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