挂钩到 _gaq.push - 谷歌分析
我在网站上的很多地方(通过脚本、Flash 等)调用 _gaq.push。我还建立了自己的本地跟踪服务。与其在当前代码中的同一点调用我的服务,不如创建一个每次调用 _gaq.push 时调用我的代码的函数。
例如:
if(_gaq.push is called){
$.get('http://mydomain.com/tracking_pixel.gif');
}
I call _gaq.push in a lot of various places on my website (via scripts, flash etc). I have also set up my own local tracking service. Rather than call my service at the same point in my current code is it possible to create a function which calls my code everytime I call _gaq.push.
eg:
if(_gaq.push is called){
$.get('http://mydomain.com/tracking_pixel.gif');
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在变量中捕获
_gaq.push
函数,然后使用您自己的函数覆盖它,该函数调用原始函数,然后调用您的代码。然后,在您覆盖它之后调用_gaq.push
的任何内容都会调用两者。例子:Capture the
_gaq.push
function in a variable and then override it with your own function that calls original and then calls your code. Then anything that calls_gaq.push
after you override it will call both. Example:如果采用反向模式呢?
我忽略如何使用 _gaq.push,但您始终可以参数化 doPush 传递所需的参数并相应地调用
_gaq.push
。What about doing in reverse mode?
I ignore how to use _gaq.push, but you can allways parametrize doPush passing your needed arguments and call
_gaq.push
accordingly.