Two separate script tags for Google Analytics?

前端 未结 5 1026
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 13:04

Does anyone know why Google Analytics requires two separate script tags?

Specifically, their instructions advise users to embed the following snippet of code into a web

5条回答
  •  忘了有多久
    2021-02-05 13:31

    For what it's worth, we make substantial use of the onclick="pageTracker._trackPageview(%filename%)" mechanism to track direct file downloads, but still don't want to track the actual pageview until the page has completely loaded. We have to include the 1st tag at the top of the page to enable that, but leave the final _trackPageview() call at the end (well, we much with the var pageTracker bit too).

    Not necessarily why they break it up that way, but it makes it a little easier for our purposes.

提交回复
热议问题