function ga_push_analyticsjs_measurement_protocol_mapping in GA Push 7
Same name and namespace in other branches
- 8 ga_push.module \ga_push_analyticsjs_measurement_protocol_mapping()
Translates Analytics.js keys to UTMP keys.
Push array data uses Analytics.js keys to name each param. UTMP uses another set of keys. This method translates those keys.
Parameters
array $data: Array with keys to be translated.
Return value
array Array with keys translated.
6 calls to ga_push_analyticsjs_measurement_protocol_mapping()
- ga_push_method_php_utmp_construct_event_request_data in inc/
ga_push.utmp.php.inc - Returns data array for a event tacking.
- ga_push_method_php_utmp_construct_exception_request_data in inc/
ga_push.utmp.php.inc - Returns data array for a exception tracking.
- ga_push_method_php_utmp_construct_pageview_request_data in inc/
ga_push.utmp.php.inc - Returns data array for a pageview tracking.
- ga_push_method_php_utmp_construct_social_request_data in inc/
ga_push.utmp.php.inc - Returns data array for a social tracking.
- ga_push_method_utmp_php_construct_ecommerce_request_data in inc/
ga_push.utmp.php.inc - Returns data arrays for a eCommerce tacking.
File
- ./
ga_push.module, line 854 - Drupal Module: GA Push.
Code
function ga_push_analyticsjs_measurement_protocol_mapping($data) {
$map = ga_push_analyticsjs_measurement_protocol_map();
$data_mapped = array();
foreach ($data as $key => $value) {
$mkey = isset($map[$key]) ? $map[$key] : $key;
// Replace custom dimensions and metrics that uses Analytics.js keys with UTMP keys.
$mkey = str_replace(array(
'dimension',
'metric',
), array(
'cd',
'cm',
), $mkey);
$data_mapped[$mkey] = $value;
}
return $data_mapped;
}