we have our hotel website wherein the actual booking engine is inside an 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.
*return validate(); _gaq.push(['_linkByPost',this]);*
When I click the check availability button it will redirect to reservation.aspx.
inside the reservation.aspx I have the following analytics script
<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.
Inside this iframe we have a different script which we put for cross domain tracking. Note that this script is located inside the body tag.
<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. For testing what we did is to create 3 confirmed reservation and check in google analytics if the trackPageview ‘Confirmation’ will have 3 pageviews. But unfortunately it only recorded 1 pageview.
What do I miss with the setup? I was hoping that at least it will track all of them.
We just removed the iframe as there are also security issues that we faced when using iframes.