You are here

function hook_google_analytics_reports_api_reported_data_alter in Google Analytics Reports 8.3

Same name and namespace in other branches
  1. 7.3 google_analytics_reports_api/google_analytics_reports_api.api.php \hook_google_analytics_reports_api_reported_data_alter()

Allow modules to alter Google Analytics reported data after executing.

Parameters

string $name: Name of Google Analytics field without "ga:" at the beginning.

mixed $value: Value of current Google Analytics field.

1 function implements hook_google_analytics_reports_api_reported_data_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_api_reported_data_alter in ./google_analytics_reports.module
Implements hook_google_analytics_reports_api_reported_data_alter().
1 invocation of hook_google_analytics_reports_api_reported_data_alter()
GoogleAnalyticsReportsApiFeed::sanitizeReport in google_analytics_reports_api/src/GoogleAnalyticsReportsApiFeed.php
Sanitize report data.

File

google_analytics_reports_api/google_analytics_reports_api.api.php, line 25
Hooks provided by the Google Analytics Reports API module.

Code

function hook_google_analytics_reports_api_reported_data_alter(&$name, &$value) {
  switch ($name) {
    case 'userType':
      $value = $value == 'New Visitor' ? t('New Visitor') : t('Returning Visitor');
      break;
    case 'date':
      $value = strtotime($value);
      break;
    case 'yearMonth':
      $value = strtotime($value . '01');
      break;
    case 'userGender':
      $value = $value == 'male' ? t('Male') : t('Female');
      break;
  }
}