Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Impossible to track visits/referral from an iframe

8:54 am on Dec 1, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 15, 2004
votes: 0


We have created a website that sales online ferry tickets.
We also created an affiliate system and propose our booking engine to third party websites (via an iframe).

Every time a user is searching from this engine (in iframe), there is a form submission to www.example.com/redirecting.php?aff=affiliate_name.

We can not tracks visits (as referrals or as new visits) from third party websites.
Analytics does not count the clicks that comes from the iframe.
We thought it was an issue of the submitting form. So, we added a direct link to our site in the iframe to test it and the result is the same. Nothing is counted.

Is there any way to track those visits/referals in iframes added on third party websites?
Is there a way to add analytics code somehow in this iframe and be able to record only the clicks and the parent website as referal?

Thank you in advance!

[edited by: mademetop at 11:01 am (utc) on Dec 13, 2017]
[edit reason] No domain names please as TOCs [/edit]

9:00 am on Dec 1, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
votes: 893

Include a tracking gif* in the affiliate code you furnish.

* A tracking gif is just a clear .gif image, typically 11 pixel. The gif is hosted on your server. You can then see where it is and how many times it is called (loaded) by your analytics program.
10:28 am on Dec 13, 2017 (gmt 0)

New User

joined:Dec 13, 2017
votes: 0

There are many features that are not available on Google Analytics such as multiple session goal tracking and keywords through which a visitor found our website. Multiple session tracking is required on many websites which have games in an iframe

[edited by: mademetop at 10:58 am (utc) on Dec 13, 2017]
[edit reason] No domain names please as TOCs [/edit]

11:06 pm on Jan 8, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
votes: 283

What exactly do you want to track?

On the one hand, it is true that iframes cannot communicate with a parent page on a separate domain. However, there are some ways around that. The simplest one is to use get parameters in the URL in the iframe src. You can pass anything that isn't private that way.

If you want to get a tiny bit fancier, you have them put a script on their page that creates the iframe. The advantage of this is that everything that is available via Javascript on the main page is available to your script. You can use some basic processing to pass that into the iframe via get parameters. This is why iframes are commonly implemented this way.

So, for example, you use JS to parse the parent page URL and the you use JS to create the iframe element with a src attribute like

Then you know your referring domain and page inside your iframe and can track that any way you want.... as just one example of getting some tracking there.

That example is not the greatest, because the parent page should already be the referring page for an iframe. So if you have analytics for the iframe, you should already have the referrer data.

As for adding analytics code, you just add it. Just like on any page. There are some special considerations with iframes though.
- [developers.google.com...]
- [support.google.com...]
- [simoahava.com...]

You might want to implement it with Google Tag Manager and then pull the referrer data and push that to the data layer.
11:10 am on Feb 9, 2018 (gmt 0)

New User

joined:Jan 31, 2018
posts: 1
votes: 0

There is software you can implement quite easily and it tracks the users of your websites. It gives you names, emails, social media handles, everything you need to segment your market and contact them.
Some have a cost, I'm sure there are some free which are efficient.

[edited by: mademetop at 5:42 am (utc) on Feb 14, 2018]
[edit reason] No promotions or link drops please [/edit]