跟踪在远程网站上运行的小部件的展示次数 [英] Track number of impressions of a widget running on a remote website

查看:107
本文介绍了跟踪在远程网站上运行的小部件的展示次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个在许多网站上托管的小部件。我最初实现的代码只使用jQuery和JSONP来构建小部件。虽然我们在网站上实现了其他小部件的不幸经历,但是在其中的其他小部件已经有非常差的JavaScript,因此我们创建了第二个版本,一个IFrame。我已经阅读过谷歌分析网站,您可以很容易地跟踪IFrame中的使用情况,但是有什么方法可以使用Google Analytics跟踪原始无iframe版本的使用情况。我当然可以简单地在我身边有一个应用程序,它计算我用来呈现窗口小部件的Web服务的时间数,并计算我的网站上的推介数量,但这种接缝像重新发明轮子时我们已经有Google Ananlytics来执行此操作。

解决方案

我不认为这是重新发明轮子,因为Google Analytics不是为了做这个。

使用iframe的好处是iframe的内容位于您的网站上,因此在您的控制之下。如果你的插件在野外,你所做的所有事情都会与全局页面名称空间共享,而其他扩展名也会以同样的方式杀死你,你的扩展名可能会杀死其他扩展名。



您对您的扩展实施分析,如果它也使用Google Analytics,则可能会对网站造成严重影响。

Google Analytics中单个页面上的多个跟踪器非常棘手。这可能但不是很好的支持,不推荐由Google推荐。



当您的Google Analytics设置与页面上的其他跟踪器发生冲突时,就会出现问题。由于您共享相同的Cookie,因此两个跟踪器配置必须兼容。
例如:

如果使用 _setAllowHash ,而另一个不会为每个一次pageview被触发,可能会破坏两个实现相当糟糕。



所以,如果你有其他方法来跟踪你的扩展去做。尝试仅在您的域名上使用Google Analytics,所以如果您在iframe中执行此操作,则可以自由使用,否则请尽量避免使用它。



如果您可以更新其他扩展名,为什么不把它替换为iframe的版本呢?


I have created a widget that is being hosted on a number of websites. I originally implemented the code using only jquery and JSONP to buid the widget. Upon implementing the widget on live webiste though we had the unfortunate experience of that other widgets which were on the site already had really poor javascript in them which killed our widget, so to cut a long story short I have created a second version which works using an IFrame. I have read up on the google analytics site that you can track usage in an IFrame fairly easily, but is there any way that I could track the usage of the original, iframeless version using Google Analytics. I could of course simply have an app on my side which counts the number of time the webservice I'm using to render the widget is called, and count the number of referrals on my site, but this seams like re-inventing the wheel when we already have Google Ananlytics to do this.

解决方案

I don't think it's reinventing the wheel since Google Analytics is not designed to do this.

The advantage of having an iframe is that the content of the iframe is on your site, and thus under your control. With your plugin on the wild everything you do is shared with the global page namespace and in the same manner the other extension killed yours, your extension could have killed others.

If you implement analytics on your extension you could be impacting the site very heavily if it also uses Google Analytics.

Multiple trackers on a single page is tricky in Analytics. It's possible but not very well supported and not recommended by Google.

The problem happens when you have conflicting Google Analytics settings with the other trackers on the page. Since you're sharing the same cookies both tracker configurations must be compatible. eg:

If one uses _setAllowHash and the other does not the cookies will be reset for each time a pageview is fired, possibly breaking both implementations pretty badly.

So if you have other means to track your extension go for it. Try to use Google Analytics only on your domain, so you're free to go if you're doing it inside your iframe, otherwise try to avoid it.

If you can update the other extensions that are out there, why not just replace it with the iframe versions of it?

这篇关于跟踪在远程网站上运行的小部件的展示次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆