You are here

function google_analytics_reports_get_fields in Google Analytics Reports 7.3

Same name and namespace in other branches
  1. 8.3 google_analytics_reports.module \google_analytics_reports_get_fields()

List of Google Analytics dimensions and metrics.

Return value

array An associative array containing list of Google Analytics column objects. Each object is associative array containing:

  • gid: The primary identifier for a column.
  • type: The type of column.
  • data_type: The type of data this column represents.
  • column_group: The dimensions/metrics group the column belongs to.
  • ui_name: The name/label of the column used in user interfaces (UI).
  • description: The full description of the column.
  • calculation: This shows how the metric is calculated.
3 calls to google_analytics_reports_get_fields()
google_analytics_reports_google_analytics_reports_api_reported_data_alter in ./google_analytics_reports.module
Implements hook_google_analytics_reports_api_reported_data_alter().
google_analytics_reports_plugin_query_google_analytics::query in plugins/google_analytics_reports_plugin_query_google_analytics.inc
Generate a query and a countquery from all of the information supplied to the object.
google_analytics_reports_views_data in ./google_analytics_reports.views.inc
Implements hook_views_data().

File

./google_analytics_reports.module, line 250
Front-end interfaces that use the Google Analytics Reports API module.

Code

function google_analytics_reports_get_fields() {
  $fields =& drupal_static(__FUNCTION__);
  if (!isset($fields)) {
    if ($cache = cache_get('google_analytics_reports_fields')) {
      $fields = $cache->data;
    }
    else {
      $fields = db_select('google_analytics_reports_fields', 'g')
        ->fields('g')
        ->execute()
        ->fetchAllAssoc('gaid');
      cache_set('google_analytics_reports_fields', $fields, 'cache');
    }
  }
  return $fields;
}