You are here

function ga_push_method_datalayer_js_push_script in GA Push 8

Same name and namespace in other branches
  1. 7 inc/ga_push.datalayer.inc \ga_push_method_datalayer_js_push_script()

Generate the GA Push script code by type.

Parameters

array $push: Push data.

string $type: Push type.

Return value

string Script code.

1 call to ga_push_method_datalayer_js_push_script()
ga_push_method_datalayer_push in inc/ga_push.datalayer.inc
Send the ga push to JS on page load using Universal Analytics Event Tracking.

File

inc/ga_push.datalayer.inc, line 52
Datalayer js: method and functions.

Code

function ga_push_method_datalayer_js_push_script(array $push, $type) {
  switch ($type) {
    case GA_PUSH_TYPE_EVENT:
      $script = _ga_push_method_datalayer_js_push_event_script($push);
      break;
    default:
      $script = NULL;
  }
  return $script;
}