Make Google Analytics count visits to 3rd party site using iFrame (Hidden) - iframe

Will Google Analytics count visits/page views etc if I place a hidden iFrame in my web page ?
The iFrame source has a Google Analytics tracking code installed.
My users browse the site from a mobile device such as Android/iPhone.
My purpose is that the 3rd party site will count my page views as their own (As if the user actually visited their web page)
Making the iFrame hidden is possible in several ways:
Making its style hidden.
Setting its size to a small size were the user won't notice it much.

Considering your intentions, Google Analytics will divide the data collections from both sites, even beign inside the iFrame.
Only 2 things to watch out for:
- The UAs have to be different for both sites
- P3P: Some browsers wont allow the site inside the iFrame to write cookies, as it will be considered third party, so you´ll have to use P3P to fix that.

Related

Google analitycs and iframe

We have a website with iframe.
In this website, some iFrames display dynamic questionnaires which coming from our different server.
We have declared both properties in Google Analytics (GA). (Main site and site retrieved through iFrames).
The sessions seem to be detected but NONE of the properties let us see the analytics page (with the % on each fields, heat maps and so on) in GA itself.
We can see analytics page (part of behavior menu) on the main site thanks to the GA Chrome extension.
We are looking for a way to detect the users behavior in the questionnaires contained in the iFrames.
Look into the documentation for cross domain tracking with iFrames. It does not exactly cover your requirements (since you seem to use different properties for host page and framed page) but it is a good example for the postmessage interface that allows cross-domain communication in frames (as long as you control both pages). So you can use postmessage to send data from the framed form to the host page and set up a listener there that sends data to GA every time the listener is invoked (the linked docs have a code example, so I won't repeat that here).

Preventing an iframe on the same domain from triggering a page exit in Google Analytics

I am working on a third party website that contains a web application embedded in an iframe on the home page. This iframe is hosted on the same same sub/domain.
Currently page views are being tracked with _trackPageview. Due to a requirement by marketing both pages use the same Google account Id.
Since the iFrame was implemented the marketing department has noticed that the bounce rate has dropped to almost nothing. I suspect that this is because Google is interpreting the pageView event on the iframe as the visitor hitting another page on the website.
Just for additional information, the domain of the _gaq object is being set to "none" for both the container page and iframe.
Does Google provide a mechanism by which you can trigger PageView in such a way that it isn't interpreted as subsequent pageview in this scenario? (I know that trackEvent has a noninteraction property to deal with this?)
Am I better off just disabling the PageView for the default iframe page?
Does Google provide a mechanism - apparently yes, but probably not for your use case.
The field documentation for Universal Analytics describes the non-interaction field thusly:
Specifies that a hit be considered non-interactive.
So in UA this does no seem limited to events but to apply to all hits (which would include pageviews). I want to point out that I have no tested it and that it seems counterintutive, so it might simply be that the documentation is incomplete/wrong here.
However as you are using "classical" Analytics this does not apply to you. Since upgrading the code is a good idea in any case you might want to push for an update to Universal Analytics (this piqued my curiosity so I will test this over the next few days and update this answer with the results - maybe you want to wait until then, or simply test it yourself).
It's possible, but not 100% clear to me that disabling the PageView event on the iframe will prevent your users from registering a page exit (the pageview may get recorded regardless). You can try removing that event and see if it works.
But a better way may be to implement a custom filter on a new View excluding traffic to that specific class of iframes. Make sure you keep your old View (or create a new one with further filters) to make sure you're capturing those iframe views, if you think that's necessary.

How can I tell if a website is firing virtual page views?

Is there a way to know how many page views are being fired, including virtual pageviews, when a browser lands on a page?
I'm investigating a severe bounce rate drop that is pretty clearly a technical issue since there has been no content or layout changes on the site.
We do have:
2 Google Analytics tags (Classic and Universal) throughout the site;
Optimizley is set up and testing.
Could this cause the problem?
Note, there is currently no event tracking on the site, just the base analytics tags.
Is there a way to see what tags (assuming that's it) are causing the issue? I am using httpfox (like fiddler) and added filter "utm" to see what's going on. Sure enough, 2 GA tags firing plus 2 dart pixels.
Would those cause page views though?
To check what is firing on the entire page. Download firbug for firefox and add the "omnibug" extension. The omnibug extension should be in the firefox firebug window when you open it.
When you go the omnibug in the firefix panel, you will see EVERYTHING THAT IS FIRING!
Is that what you are looking for?
To check what pageviews are firing correctly VERY QUICKLY in Google analytics. Do the following;
Make sure the google analytics code you have is on the page you want to track
Make sure your IP is not excluded or filtered out of the analytics profile
Login to your google analytics account
Go to Real-Time section on the left hand sidebar.
Click on Content
Go to your site and click on the link or go to the virtual pageview page you added the code to and then watch if that link shows up in the real-time -> content section.

IFrame Subdomain tracking with Google Analytics

I have a website that I created for the company I work at. This site is on a subdomain and is brought in as an iframe within another company's retail site, as we offer services under them. Is there a good way to track this with google analytics? I've never tracked a subdomain before, let alone in an iframe.
I've created a test analytics account, and added the top level domain, but I only put the tracking code on the pages for the subdomain that I created the site on. Will this even give me any information? and if that part of it works, is the information from an iframe setup accurate? I know from a design standpoint an iframe is kind of off in it's own world within a world, but does anyone have any experience on how google sees a site like that?
I've searched the forums and anywhere else i could think of, and they have bits of info on subdomains, practically nothing on iframes, and nothing combining the two. I have no access to adding any tracking code to the partner company's retail site either.
If your iframe hosted content is not on the same domain as the parent page (which I'm going to assume is not, based on the context of your question), then google will report the page name as the URL of the iframe, not the parent page.
GA code has a way to override the default page name, however, you cannot retrieve the parent URL in this case, because this is considered cross-site scripting (XSS).
The only way to get info about the parent page in this case is for whoever has control over the parent page that has the iframe tag, to pass the parent URL to the iframe by adding a query string parameter to the iframe src="..." attribute (also, same thing for any other info you want to pass to the iframe page). Then you can write some javascript to retrieve those values from the URL and pop whatever you want, including overriding the default reported page name (which you would do by setting the optional 2nd param to your _trackPageview call).
If the iframe content IS on the same domain (even if it is a subdomain of the parent page), then you can access the parent page properties using parent.window.whatever instead window.whatever.
Well, from what I understand, you have a page that will be inserted inside an iframe to a second page, but we need to know if the page that will host the iframe is the same domain as the calling page:
If the page called by the iframe in the same domain of the calling page:
In this case, you can insert the block of JavaScript Google Analytics, as both the iframe on the main page, and we have the measurement data from the main site, the iframe.
If the page that calls the iframe belongs to a different domain:
Some of the features that are measured are in frames within the site. These iframes indicate the domain, for example, site.com.br. Whenever a page in one domain has a frame to a different domain prevents the browser cookies that are stored inside the Iframe, which in the case would prevent the measurement.
Cookies are nothing more than small text files that are stored by your browser on the machine. Most of our cookies are session cookies that are automatically deleted from your hard disk in the closing of the window. Persistent cookies also are used by websites to facilitate identification of your computer in the next visit you make to the site. Inactivation of the cookies can be made in your browser however, this will preclude all the functions available on the site.
To allow the recording of cookies should add P3P headers in HTTP server that serves pages. This header causes no change in display mode or operation of the pages. Just instruct your browser to allow to record cookies of third, however, it has a bigger role in Internet Explorer. If you do not set, you can receive data from other browsers (Google Chrome, Firefox, Opera, etc. ..), but Internet Explorer still has a widespread use of the mass of the population.
Imagine that we have four distinct domains:
www.site1.com
www.site2.com
www.site3.com
www.site4.com
These four pages will receive the iframe tag:
<iframe Src="http://www.meusite.com.br/anuncio.php">
The anuncio.php page need to have a call header p3p for accept the third party cookies.
To add the header p3p use the code below (should be added to all pages that belong to the same domain)
ASP.Net
HttpContext.Current.Response.AddHeader ("p3p", "CP = \" "PSA CONE NOI ONL OUR BUS \" "")
PHP
header ('P3P: CP = "NOI PSA CONE ONL OUR BUS"');
JSP
response.setHeader ("P3P", "CP =" NOI PSA CONE ONL OUR BUS '")
ColdFusion
<cfheader name="P3P" value="CP='PSA CONo OUR ONL NOI BUS'" />
I hope to have helped:)

Is it advisable to load display advertising in an iframe?

Some display advertising campaigns are very JavaScript heavy and it has a jarring effect on page load time because the ad is generally inline JavaScript - the useful parts of the page doesn't render until the ad did its thing.
A solution seems to be to load the ad in an iframe in order to display useful content to a user while the ad loads in the background and "snaps into place" when it is ready.
I've been told a number of drawbacks of an iframe approach:
You are limited in the types of campaigns you can host - for example, no expanding ads that roll over content.
If you have multiple ad units on one page you can't have combined campaigns.
Advertisers avoid iframes because it is easier to game the system with false impressions
Are these real concerns? If so, are there any workarounds or should I keep display ads on page?
In my experience we have not had any problems with placing display advertising in IFRAMEs.
We still have ads that display
expanding content over the rest of
the page. For this to work, it
requires the company delivering the
creative to support "iframe busting"
which does require you to host a
special file on your web server.
Pointroll, Eyewonder and the like
support this. The actual calls to the
ad network (doubleclick in our case)
don't change really. Note that we have a policy of allowing expandable IFRAME content only on user-click; perhaps that is a key factor that enables this technique.
I'm not sure
what a "combined campaign" but I'm
not sure how it'd be impacted. Our calls to Doubleclick don't change - all the same parameters are supported in terms of identifying the site, zone, location, size, tile etc.
We moved to an IFRAME model from Javascript mostly for the freebie "asynchronous" aspect of IFRAME loading and also because it acts as a sandbox; we found cases where faulty ad creative could overwrite our whole DOM and blow up the page on certain browsers.
There are now techniques that can be used to load content via Javascript and still be asynchronous (XHR injection) but its not for the faint-of-heart and is likely to be incompatible with ad serving anyway due to the need to serve content off the same domain.
Note that moving to IFRAMEs won't reduce page load time as measured by any kind of browser plugin, but it will at least background-load the ads meaning the browser won't halt rendering for the Javascript. We've also experimented with techniques that utilize Javascript to defer the enabling of the IFRAME src parameter until a time that we're ready to let the Ads start downloading (for example, after the above-the-fold parts of the page have rendered). However, its a fine balance between showing the paying Ad content and your page's main content.
Those are valid concerns. I would also add that:
When search engines find the advertisement, they will add them to their database as separate web pages, i.e. the link in the search results will be to the ad page (iframe), not to the page that contains the iframe.
It is more difficult for users with limited accessibility to navigate to the ads and click on their links. For example, if the user has keyboard access only.

Resources