You are here

function google_analytics_reports_get_fields in Google Analytics Reports 8.3

Same name and namespace in other branches
  1. 7.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()
GoogleAnalyticsQuery::query in src/Plugin/views/query/GoogleAnalyticsQuery.php
Generate a query and a countquery from all of the information supplied to the object.
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_views_data in ./google_analytics_reports.views.inc
Implements hook_views_data().

File

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

Code

function google_analytics_reports_get_fields() {
  $fields =& drupal_static(__FUNCTION__);

  // todo: fetch data from cache.
  if (!isset($fields)) {
    $fields = \Drupal::database()
      ->select('google_analytics_reports_fields', 'g')
      ->fields('g')
      ->execute()
      ->fetchAllAssoc('gaid');
  }
  return $fields;
}