Explaining Google Analytics async tracker

前端 未结 2 766
不思量自难忘°
不思量自难忘° 2021-01-05 07:45

I have a as to how google\'s async analytics tracker works. The following code is used to init a command array:



        
2条回答
  •  暖寄归人
    2021-01-05 07:51

    Yes, you're right that if the user clicks away from the site before ga.js has loaded and has executed the __utm.gif request to Google's servers, then it will not track the _gaq array and that information is gone forever. But this version code still provides many benefits over the older synchronous code.

    First, the loading of ga.js using this method is not blocking.

    Cleverly, the loading of ga.js is injected indirectly via JavaScript, rather than through a hard-coded

提交回复
热议问题