Answer the question
In order to leave comments, you need to log in
How does Google Analytics parse the request queue?
Hello!
Asynchronous Google Analytics works through a queue. Initially, an array is created, calls are added to it, and when either is loaded, the calls are executed. The question is how does this happen?
Let's assume that we have collected such an array:
var funcQuery = [
['firstFunc', 'UA-XXXXX-X'],
['secondFunc', '1'],
['thirdFunc', {"data":123}, 'bla bla'],
];
Answer the question
In order to leave comments, you need to log in
window.firstFunc = function (p) {
console.log('firstFunc', p);
}
window.secondFunc = function (p) {
console.log('secondFunc', p);
}
window.thirdFunc = function (o, p) {
console.log('thirdFunc', o, p);
}
var funcQuery = [
['firstFunc', 'UA-XXXXX-X'],
['secondFunc', '1'],
['thirdFunc', {"data":123}, 'bla bla'],
];
setTimeout(function () {
for (var i = 0; i < funcQuery.length; i++) {
window[funcQuery[i][0]].apply(null, funcQuery[i].slice(1));
}
}, 2000);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question