We use iframe contact forms from a marketing software provider. When someone lands on our site and fills out a form, they are redirected to a thank you page.

However, the domain of these iframes is being counted as a referral when the traffic originated from somewhere else.

How do I prevent this? It is showing the form as the referral for all goals when that is not correct.

enter image description here


iframes are tricky and usually you want to avoid them when working with GA because of issues like this. Remember that an iframe is a separate website embedded in your site so it makes sense that you are seeing referral data like you are seeing.

If you dont have access to the iframe site unfortunately you cant do anything. However, if you do have access to the iframe you can drop Google Tag Manager then you can use the postMessage API to send a signal from the child iframe to the parent, listen this signal in your site to then send an event to Google Analytics.

Simo Ahava, the pro of pros uses a different approach with customTask. I'd do a Google search for his name and iframe tracking and you'll see it quickly.

  • There is a Javascript embed option. Would this offer better results as far as analytics or would the same problem exist? <script charset='utf-8' type='text/javascript' src='domain.leadliaison.com/tracking_engine/…> – Brian May 7 '20 at 13:54

You can add the host domain for the iframe to Google Analytic's referral exclusions list. That list is meant for cases like this where you host part of your content with a third party.

In addition to not counting referrals from the iframe, it also won't start new Google Analytics sessions for users when they use one of your pages with the iframe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.