简体   繁体   English

与其他域的iframe跟踪不一致

[英]iframe tracking with a different domain is not consistent

we have our hotel website wherein the actual booking engine is inside an iframe. 我们拥有我们的酒店网站,实际的预订引擎位于iframe中。 Now, we are validating our conversion and found out that the number of booking is not consistent with the number of pageview that we have for the confirmation page. 现在,我们正在验证转换,发现预订数量与确认页面的浏览量不一致。

This is the analytics code inside the home page where the booking form is located. 这是预订表单所在主页内的分析代码。

    <script type="text/javascript">
<!--

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1301114-2']);
  _gaq.push(['_setDomainName', '.florahospitality.com']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_setAllowHash', false]); 
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
//-->

</script>

On the onclick event of the check availability button I put this code. 在检查可用性按钮的onclick事件上,我放置了这段代码。 *return validate(); _gaq.push(['_linkByPost',this]);*

When I click the check availability button it will redirect to reservation.aspx. 当我单击“可用性检查”按钮时,它将重定向到Reservation.aspx。

inside the reservation.aspx I have the following analytics script 在Reservation.aspx内,我具有以下分析脚本

     <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1301114-2']);
  _gaq.push(['_setDomainName', '.florahospitality.com']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_setAllowHash', false]); 
  _gaq.push(['_trackPageview']);
  _gaq.push(function() {   
  var pageTracker = _gat._getTrackerByName();   
  var iframe = document.getElementById('reservationFrame');   
  iframe.src = pageTracker._getLinkerUrl('https://reservations.synxis.com/xbe/rez.aspx?Hotel=24309&template=flex&shell=flex&Chain=5375&locale=ru&arrive=10/31/2012&depart=11/01/2012&adult=2&child=0&rooms=1&start=availresults&iata=&promo=&group='); });

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

And inside also the reservation.aspx is an iframe which contains the actual url of the booking engine which is hosted in a different domain. 而内部的Reservation.aspx则是一个iframe,其中包含在另一个域中托管的预订引擎的实际网址。

Inside this iframe we have a different script which we put for cross domain tracking. 在此iframe中,我们有一个用于跨域跟踪的不同脚本。 Note that this script is located inside the body tag. 请注意,此脚本位于body标签内。

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1301114-2']);
  _gaq.push(['_setDomainName', 'none']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview', 'CheckAvailability']);

  _gaq.push(['secondTracker._setAccount','UA-26368520-41']); 
  _gaq.push(['secondTracker._setDomainName', 'none']);
  _gaq.push(['secondTracker._setAllowLinker', true]);
  _gaq.push(['secondTracker._trackPageview', 'CheckAvailability']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

As you can see we are using the trackPageview variable to determine our conversion. 如您所见,我们正在使用trackPageview变量来确定转换。 For testing what we did is to create 3 confirmed reservation and check in google analytics if the trackPageview 'Confirmation' will have 3 pageviews. 为了测试我们所做的是创建3个确认的预订,并检查google Analytics(分析)中trackPageview“确认”是否具有3个浏览量。 But unfortunately it only recorded 1 pageview. 但是很遗憾,它仅记录了1次综合浏览。

What do I miss with the setup? 我会错过什么设置? I was hoping that at least it will track all of them. 我希望至少它将跟踪所有这些对象。

我们只是删除了iframe,因为使用iframe时还会遇到安全问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM