function _ga_push_method_datalayer_js_push_send_script in GA Push 8
Same name and namespace in other branches
- 7 inc/ga_push.datalayer.inc \_ga_push_method_datalayer_js_push_send_script()
Generates the datalayer send JS code.
Parameters
array $push: Data.
Return value
string JS code with push code.
1 call to _ga_push_method_datalayer_js_push_send_script()
- _ga_push_method_datalayer_js_push_event_script in inc/
ga_push.datalayer.inc - Generates the ga JS code for pushing an event to GA.
File
- inc/
ga_push.datalayer.inc, line 97 - Datalayer js: method and functions.
Code
function _ga_push_method_datalayer_js_push_send_script(array $push) {
// Remove empty parameters:
$push = array_filter($push);
// Convert to JS function.
$script = "dataLayer.push(" . json_encode($push) . ");\n";
return $script;
}