BDH
BDH

Reputation: 156

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?

Upvotes: 1

Views: 275

Answers (2)

Eike Pierstorff
Eike Pierstorff

Reputation: 32770

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).

Upvotes: 1

samthebrand
samthebrand

Reputation: 3090

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.

Upvotes: 0

Related Questions