是否有机会跟踪点击并从iframe获得引荐流量?
我有管视频网站,我的视频嵌入了许多其他网站,但是当视频嵌入其他网站时,找不到解决方案来跟踪iframe中的链接点击
这是我网站上的嵌入代码
<iframe src="http://mysite.com/embed.php?id=4589"></iframe>
我尝试在embed.php里面放这样的东西
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-111111-1']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('http:' == document.location.protocol ? 'http://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
而且比即时更改链接到此
<a href="http://mysite.com/video/55454.html" onclick="_gaq.push(['_link', this.href]);return false;">Continue</a>
但这不是解决方案
最佳答案
您可以在js文件中添加默认的ga代码,并将其添加到所有嵌入页面和视频页面中,例如embed.php,55454.html等
要触发事件分析,请使用以下命令:
//send to analytics
// var _gaq = _gaq || []; //if already loaded e.g. single page app, keep comment out
// _gaq.push(['_setAccount', 'UA-YOUR-ACCOUNT']); //comment out if single page app
_gaq.push(['_trackPageview','/home/landingPage']);
//sendEventToAnalytics
// var _gaq = _gaq || []; // if single
// _gaq.push(['_setAccount', 'UA-YOUR-ACCOUNT']); // if single
// _gaq.push(['_trackPageview']); //if single
_gaq.push(['_trackEvent', eventCategory, eventAtion, eventLabel]);
检入api,
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide