Asynchronous google analytics
Hi there: When you need to register some javascript activity from your web site into google analytics they say you may use (for example):
_gaq.push(['_trackEvent', 'Param1', 'Params2']);
or
开发者_运维知识库_gaq.push(['_trackPageView', 'URL']);
Does anybody knows this function call works? Does it make an Ajax request to Google in order to send the data? Does it store the info and pushes it to the server on unload event?
Thanks.
_gaq
acts as a queue so you can push commands before Analytics has fully loaded; once it has it will start executing what you've queued. See the docs.
Thanks a lot to yc who finally gave the answer I was looking for. I just put it here so I can mark this question as solved.
As he pointed, they make a clever approach to this problem requesting an image file in their servers passing some parameters; this way they can avoid cross-domain issue. The link he wrote (this one) also has a reference to page from analytics google group with more info (Analytics Google group)
精彩评论