My โappโ is a single web page (myPage.html) displaying elements on a Google map. Therefore, this is not a scenario where a user moves between multiple pages.
Therefore, I use events to track interactions. However, it seems strange to me to believe what I see in statistics.
I checked the events for the syntax, and it seems that everything is in order.
_gaq.push(['_trackEvent', 'MyApp', 'ChangeTav', newTab]); _gaq.push(['_trackEvent', 'MyApp', 'Load', 'itemType', loadTime]); ....
What interests me, I add Arrays to the _gaq
object, but when do they really get dispatched? What happens if the user closes the browser? And is there a way for me to โforceโ to send these values?
In the opposite case, the user remains on the page for some time, the values โโare added to _gaq
, but how am I sure that they are not lost?
- Update -
With push, am I just adding an array to the array, or is it wrong? Therefore, nothing happens at this particular moment; I have not seen any callbacks or overridden methods. Please correct if I missed something.
- Update 2 -
http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html
It seems like I'm using sync or async. For async (I use) ...
To call an API call into a queue, you must convert it from traditional JavaScript syntax to an array of commands. Command arrays are simply JavaScript arrays that match a specific format. The first element in the command array is the name of the method of the tracker object that you want to call. It must be a string. The remaining elements are the arguments that you want to pass to the tracker object method. It can be any JavaScript value.
When I start with var _gaq = _gaq || [];
var _gaq = _gaq || [];
, it becomes an array. However, I never see the values โโbeing removed from the queue (_gaq), so I assume they are never sent.
--- OK, here we go ---
http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gaq.html#_gaq.push
This function is called push, so the array can be used in the _gaq place before Analytics is fully loaded. While Google Analytics is loading, the teams will be queued / put on an array. When Analytics finishes loading, it replaces the array with the _gaq object and executes all the commands in the queue. Subsequent calls to _gaq.push enable this function, which executes the commands as they are pressed.