Mobile app version of vmapp.org
Login or Join
Lengel546

: How to correctly track the analytics when using iframe In our main aspx page we have this analytics code <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount',

@Lengel546

Posted in: #Analytics #AspNet #GoogleAnalytics

In our main aspx page we have this analytics code

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1301114-2']);
_gaq.push(['_setDomainName', 'florahospitality.com']);
_gaq.push(['_setAllowLinker', true]);
_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=15159&template=flex&shell=flex&Chain=5375&locale=en&arrive=11/12/2012&depart=11/13/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>


Then inside this aspx page is an iframe. Inside the iframe we setup this analytics code

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1301114-2']);
_gaq.push(['_setDomainName', 'reservations.synxis.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview', 'AvailabilityResults']);

(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>


The problem is I see to pageview when I go to find the AvailabilityResults page. The first one is a direct traffic and the other one is a cpc.

How come that they have different source? I was expecting that both of them is using a direct traffic.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

1 Comments

Sorted by latest first Latest Oldest Best

 

@Barnes591

The iframe page loads after the main page has rendered the iframe element. So the flow would be -


Main Page is requested
Main page is being rendered and loaded
Iframe Page is requested from within the main page
Iframe page is being rendered and loaded


This will mean that the iframe page will always show up as a Direct traffic. The Main page would show differing sources.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme