You are here

function google_analytics_api_report_data in Google Analytics Reports 6

Same name and namespace in other branches
  1. 7 google_analytics_api.module \google_analytics_api_report_data()

Request report data.

Parameters

$params: An associative array containing:

  • profile_id: required [default=variable_get('google_analytics_reports_profile_id')]
  • metrics: required.
  • dimensions: optional [default=none]
  • sort_metric: optional [default=none]
  • filters: optional [default=none]
  • segment: optional [default=none]
  • start_date: optional [default=GA release date]
  • end_date: optional [default=today]
  • start_index: optional [default=1]
  • max_results: optional [default=10,000]

$cache_options: An optional associative array containing:

  • cid: optional [default=md5 hash]
  • expire: optional [default=CACHE_TEMPORARY]
  • refresh: optional [default=FALSE]
9 calls to google_analytics_api_report_data()
google_analytics_reports_dashboard_build in google_analytics_reports/google_analytics_reports.blocks.inc
Generates the dashboard block.
google_analytics_reports_path_mini_build in google_analytics_reports/google_analytics_reports.blocks.inc
Generates a block with the current page statistics.
_google_analytics_reports_detail_stats in google_analytics_reports/google_analytics_reports.pages.inc
Retrieves content detail stats.
_google_analytics_reports_pageviews in google_analytics_reports/google_analytics_reports.pages.inc
Renders an img element with a chart of the number of pageviews over the past 30 days.
_google_analytics_reports_top_keywords in google_analytics_reports/google_analytics_reports.pages.inc
Retrieves top keywords.

... See full list

File

./google_analytics_api.module, line 128
Implements the API through which Google Analytics data can be accessed.

Code

function google_analytics_api_report_data($params = array(), $cache_options = array()) {
  $params_defaults = array(
    'profile_id' => 'ga:' . variable_get('google_analytics_reports_profile_id', 0),
  );
  $params += $params_defaults;
  $GAFeed = google_analytics_api_new_gafeed();
  $GAFeed
    ->queryReportFeed($params, $cache_options);
  return $GAFeed;
}