I'm going to tag onto this because it's vaguely related:
I have a function defined (let's calling it "combineData") that will join the results from two different queries (and then display the resulting array on a chart). The issue that I'm running into now is that I can not for the life of me, get this "combineData" function to wait until the two query functions have returned results. I have tried a separate async library, I've tried jQuery's deferred "$.when.done()", but nothing works. I defined callback functions for the two GADash functions, and then even tried calling them [e.g. $.when(visitors1(callbackfunc), visitors2(callbackfunc)).then(combineData);].
With everything I've tried, it always executes the two GADash functions and then, without waiting for those two functions to actually return a result, the combineData() function. What am I missing?