在piwik中,是否可以根据跟踪器中的自定义变量过滤访问者图?我想显示第一个自定义变量槽中具有70
值的所有访问的演变图。我试过打这个电话给
index.php?模块=API&method=ImageGraph.get&idSite=1&apiModule=访问摘要&apiAction=get&token_auth=匿名&graphType=进化&period=天&日期=2012-01-012012-07-10&宽度=500&高度=250&filter_column=custom_var_v1&filter_pattern=70
但得到
此图没有数据。
当我移除filter_pattern
时,我得到一个图。我检查了数据库中的piwik_log_visit
表,并获得了访问记录的值。
创建一个custom_var_v1=70的段(我建议将其设置为预存档,以防流量过大)。
当您使用过滤时:
您使用的是filter_column和filter_pattern,它们是全局Piwik API筛选器。但您必须确保自定义变量数据存在于您正在查询的报表中。默认情况下,VisitsSummary.get方法可能不包含自定义变量数据。
基于自定义变量查询数据时,请使用CustomVariables.getCustomVariablesAPI方法,而不是VisitsSummary.get。
您的查询看起来像:
index.php?模块=API&method=CustomVariables.getCustomVariables&idSite=1&period=天&日期=2012-01-012012-07-10&token_auth=匿名&filter_column=custom_var_v1&filter_pattern=70
尝试细分:
尝试分段而不是过滤。segment参数允许您通过各种度量(包括自定义变量)对数据进行分段。尝试将此段参数添加到您的查询中:
&segment=custom_var_v1==70
您的查询看起来像:
index.php?模块=API&method=CustomVariables.getCustomVariables&idSite=1&period=天&日期=2012-01-012012-07-10&token_auth=匿名&segment=custom_var_v1==70