Google 分析 API:具有和不具有 'ga:eventLabel' 功能的不同会话总和

Google analytics API: different sum of sessions with 'ga:eventLabel' function and without it

我在脚本中添加了 'ga:eventLabel' 函数,会话总数从 2238 减少到 994。为什么?

我希望两个脚本的结果相同

dim=['ga:eventLabel', 'ga:source','ga:sourceMedium']
met=['ga:sessions', 'ga:users']
start_date='2019-07-01'
end_date='2019-07-03'
transaction_type='Goal'
goal_number=''
refresh_token=token
condition=''
data_2=google_analytics_reporting_api_data_extraction(viewID,dim,met,start_date,end_date,refresh_token,transaction_type,goal_number,condition)

viewID='*********'
dim=['ga:source','ga:sourceMedium']
met=['ga:sessions', 'ga:users']
start_date='2019-07-01'
end_date='2019-07-03'
transaction_type='Goal'
goal_number=''
refresh_token=token
condition=''
data=google_analytics_reporting_api_data_extraction(viewID,dim,met,start_date,end_date, refresh_token,transaction_type, goal_number,condition)```

结果如下:

--

这两个查询有两种不同的含义,不会给你相同的结果,除非你有一个数据集,其中所有会话至少有一个事件类型与之相关联。

第一个查询说: 统计我在给定日期范围内的所有用户和会话,按事件标签、来源、source/medium 和日期进行细分。因此,在这种情况下,您隐式过滤任何已知的事件标签,其中 (not set) 是空的,但已记录事件的现有标签。没有任何事件的会话被排除在外。

第二个查询说: 计算我在给定日期范围内的所有用户和会话,按来源、source/medium 和日期(不管他们是否有任何事件)。

如果您在 Google Analytics web UI 中创建这些自定义报告,则可以验证此行为。它类似于查询自定义维度:如果没有为给定的自定义维度设置值,则这些记录将被排除。