dtj4307 2015-05-30 19:18
浏览 32
已采纳

尝试使用Google AnalyticsAPI(PHP)获得移动用户的百分比

I am trying to get percentage of mobile users on a website using the Google Analytics API in PHP.

Per https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries, I am pretty sure I am using the right dimensions/metrics (below):

dimensions=ga:mobileDeviceInfo,ga:source
metrics=ga:sessions,ga:pageviews,ga:sessionDuration

I get back an array of mobile devices (expected) but see no way to convert that into a percentage.

The first array element (not set) I assume is the non-mobile traffic, but the numbers simply don't add up ( non-mobile traffic / total number of sessions doesn't equal the % mobile in the Google Analytics dashboard).

Any ideas or examples.

  • 写回答

1条回答 默认 最新

  • doumen6532 2015-05-31 08:11
    关注

    Instead of using ga:mobileDeviceInfo, I would use ga:deviceCategory. This way you're able to see the number of sessions by Desktop, Tablet, Mobile. Does this match what you see in the interface?

    dimensions=ga:deviceCategory
    metrics=ga:sessions
    

    Also bear in mind to make sure the date range/filters/segmentation of the API and the UI are the same.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起