function _ga_push_method_analytics_js_push_send_script in GA Push 7
Same name and namespace in other branches
- 8 inc/ga_push.analytics_js.inc \_ga_push_method_analytics_js_push_send_script()
Generates the ga send JS code.
Parameters
array $push: Data.
string $hit_type: The hit type: social, pageview...
Return value
string JS code with push code.
2 calls to _ga_push_method_analytics_js_push_send_script()
- ga_push_method_analytics_js_push_script in inc/
ga_push.analytics_js.inc - Generate the GA Push script code by type.
- _ga_push_method_analytics_js_push_event_script in inc/
ga_push.analytics_js.inc - Generates the ga JS code for pushing an event to GA.
File
- inc/
ga_push.analytics_js.inc, line 151 - Universal Analytics js: method and functions.
Code
function _ga_push_method_analytics_js_push_send_script($push, $hit_type) {
// Remove empty parameters:
$push = array_filter($push);
// Add the hitType: social.
$push['hitType'] = $hit_type;
// Convert to JS function.
$script = "ga('send', " . json_encode($push) . ");\n";
return $script;
}