You are here

function hook_google_analytics_reports_field_import_alter in Google Analytics Reports 8.3

Same name and namespace in other branches
  1. 7.3 google_analytics_reports.api.php \hook_google_analytics_reports_field_import_alter()

Allow modules to alter Google Analytics field data before saving in database.

Parameters

array $field: An associative array containing:

  • id: Google Analytics field id without "ga:" at the beginning.
  • kind: collection type.
  • attributes: an associative array containing:
    • type: the type of field.
    • dataType: the type of data this field represents.
    • group: The dimensions/metrics group the column belongs to.
    • status: the status of the column.
    • uiName: the name/label of the field used in user interfaces (UI).
    • description: The full description of the field.
    • allowedInSegments: Indicates whether the column can be used in the segment query parameter.
    • calculation: this shows how the metric is calculated. Only available for calculated metrics.
    • minTemplateIndex: this is the minimum index for the field. Only available for templatized fields.
    • maxTemplateIndex: this is the maximum index for the field. Only available for templatized fields
    • premiumMinTemplateIndex: this is the minimum index for the field for premium properties. Only available for templatized fields.
    • premiumMaxTemplateIndex: this is the maximum index for the field for premium properties. Only available for templatized fields.
    • allowedInSegments: Indicates whether the field can be used in the segment query parameter.
1 function implements hook_google_analytics_reports_field_import_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

google_analytics_reports_google_analytics_reports_field_import_alter in ./google_analytics_reports.module
Implements hook_google_analytics_reports_field_import_alter().
1 invocation of hook_google_analytics_reports_field_import_alter()
GoogleAnalyticsReports::saveFields in src/GoogleAnalyticsReports.php
Batch processor.

File

./google_analytics_reports.api.php, line 42
Hooks provided by the google_analytics_reports module.

Code

function hook_google_analytics_reports_field_import_alter(array &$field) {

  // Change data type for Date field.
  if ($field['id'] == 'date') {
    $field['attributes']['dataType'] = 'date';
  }
}