Therefore we needed to investigate what sort of integration points Google Analytics provides. Luckily, it provides a javascript api which we can quite easily enable access to and query for various bits of data.
Some examples of this data are...
- page visits
- visitor continent
- visitor city
- visitor browsers
- bounce rate
- mobile device usage breakdowns
Google Analytics API
The GA API is basically what we need I believe. Google refer to this API as the GA CORE Reporting API.
It is basically broken down in to two different ares. Metrics and Dimensions.
Metrics are more quantitative and Dimensions more qualitative from what I can see at first glance.
Some of the metrics that they provide include those in the Session category:
- ga:visits
- ga:bounces
- ga:entranceBounceRate
- ga:visitBounceRate
- ga:timeOnSite
- ga:avgTimeOnSite
Some of the dimensions they provide include those in the Geo/Network category:
- ga:continent
- ga:subContinent
- ga:country
- ga:region
- ga:metro
- ga:city
- ga:latitude
- ga:longitude
- ga:networkDomain
- ga:networkLocation
PHP Integration
This API also provides a PHP integration interface.
For example in PHP you can do something like this to get the visits/source keyword data.
function queryCoreReportingApi() {The API is quite plentiful and available to be called via Javascript (and Java) as well as PHP.
$optParams = array(
'dimensions' => 'ga:source,ga:keyword',
'sort' => '-ga:visits,ga:source',
'filters' => 'ga:medium==organic',
'max-results' => '25');
return $service->data_ga->get(
TABLE_ID,
'2010-01-01',
'2010-01-15',
'ga:visits',
$optParams);
}
More documentation on the API from a developer point of view is available here:
https://developers.google.com/analytics/devguides/reporting/core/v3/coreDevguide
A good initial tutorial is available here:
https://developers.google.com/analytics/solutions/articles/hello-analytics-api
Other API Functions
There are many more API requests detailed in full here at
https://developers.google.com/analytics/devguides/reporting/core/v3/
API Quotas
General Analytics API quotas. These apply to both the Analytics APIs, i.e., Management API and Core Reporting API:
50,000 requests per project per day
10 queries per second (QPS) per IP
Quotas specific to Core Reporting API:
10,000 requests per profile per day
10 concurrent requests per profile
Conclusions
Basically from my investigations, there are a lot of metrics and dimensions that we can slice and dice from this API and use in our mobile capability site.
Không có nhận xét nào:
Đăng nhận xét