本文介绍了GA查询返回唯一的计数数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google Analytics中,我已设置了一个包含一串标签( ga:dimension1 )的自定义维度。

数据示例:tag1,tag2,tag3。我也使用事件。



我使用来测试一些自定义报告。对于 tag2 它是这样工作的:


  • 指标: ga:totalEvents

  • 维度: ga:dimension1
  • > sort: ga:totalEvents
  • 过滤器: ga:dimension1 =〜(tag2)

    我收到类似这样的结果:

     

    自定义维度1 |总活动
    tag2 | 2
    tag1,tag2 | 1
    tag3,tag1,tag2 | 4

    是否有解决方案在GA查询中计算这些结果并接收类似以下内容: p>

      tag2 | 7 

    因此,我需要一个数字作为结果 - 这些行中列总计事件的计数。

    解决方案

    您将能够做的最好的方法是删除维度并只请求ga:TotalEvents。 p>


    • 指标: ga:totalEvents

    • ga:totalEvents

    • 过滤器: ga:dimension1 =〜(tag2)



    这将返回

    7



    为什么

    原因是它不像您希望的那样工作, ga:dimesion1和ga:TotalEvents。系统将为每个人返回唯一的值。



    显然有行为

      tag2 
    tag1 ,tag2
    tag3,tag1,tag2

    可能很容易就有 tag2,tag1
    tag1,tag2



    我希望这是有道理的


    In Google Analytics I have set up set a custom dimension that contains a string of tags (ga:dimension1).

    Data Example: "tag1,tag2,tag3". I also use events.

    I use Query Explorer to test some custom reports. For tag2 it is working like this:

    • metrics: ga:totalEvents
    • dimensions: ga:dimension1
    • sort: ga:totalEvents
    • filters: ga:dimension1=~(tag2)

    I receive results like this:

    Custom Dimension 1  | Total Events
    tag2                | 2
    tag1,tag2           | 1
    tag3,tag1,tag2      | 4
    

    Is there a solution to count these results in a GA query and to receive something like:

    tag2 | 7 
    

    So I need a single number as result - the count of column Total Events in these rows.

    解决方案

    The best you are going to be able to do is to either remove the dimension and just request ga:TotalEvents.

    • metrics: ga:totalEvents
    • sort: ga:totalEvents
    • filters: ga:dimension1=~(tag2)

    This will return

    7

    Why

    The reason its not working like you want it to is you are requesting a column in the database ga:dimesion1 and ga:TotalEvents. The system is going to return unique values for each of them.

    There are apparently rows for

    tag2                
    tag1,tag2           
    tag3,tag1,tag2      
    

    There could just as easily be tag2,tag1 which is different from tag1,tag2

    I hope this makes sense

    这篇关于GA查询返回唯一的计数数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 16:15