Trying to get percentage of mobile users using Google Analytics API (PHP) -


i trying percentage of mobile users on website using google analytics api in php.

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

dimensions=ga:mobiledeviceinfo,ga:source metrics=ga:sessions,ga:pageviews,ga:sessionduration 

i array of mobile devices (expected) see no way convert percentage.

the first array element (not set) assume non-mobile traffic, numbers don't add ( non-mobile traffic / total number of sessions doesn't equal % mobile in google analytics dashboard).

any ideas or examples.

instead of using ga:mobiledeviceinfo, use ga:devicecategory. way you're able see number of sessions desktop, tablet, mobile. match see in interface?

dimensions=ga:devicecategory metrics=ga:sessions 

also bear in mind make sure date range/filters/segmentation of api , ui same.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -