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.
The queue is the q array properties of the ga function.
Outputs the following:
[ ['create', 'UA-XXXXX-Y', 'auto'], ['send', 'pageview'] ]
- 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.
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.