Google Analytics - Command Queue (q)

Card Puncher Data Processing

About

It's called the command queue because rather than executing the commands it receives immediately, it adds them to a queue that delays execution until the analytics.js library is fully loaded.

Management

See

The queue is the q array properties of the ga function.

console.log(ga.q);

Outputs the following:

[
   ['create', 'UA-XXXXX-Y', 'auto'],
   ['send', 'pageview']
]

where:

  • The first parameter (create, send, …) is called the “command” and identifies a particular method.
  • Any additional parameters are the arguments that get passed to that method.

Execution

Once the analytics.js library is loaded, it inspects the contents of the ga.q array and executes each command in order. After that, the ga() function is redefined, so all subsequent calls execute immediately.

The command execute asynchonously and do not return a value.







Share this page:
Follow us:
Task Runner