I'm creating a survey with Google Forms. I need to know when the user is done with the survey so that I can have them continue on my site. I have embedded the survey as an Iframe on my website.

Is there a way to:

  • Use JavaScript to interact with the form so that my page gets an event when the form is completed?
  • Put a link on the form that the user can click on when they are done to go to a thank you page on my site?
  • Some other way of getting knowing that this user has completed the survey?

I'd think there would have to be a way to do this, but I can't seem to find it. If it isn't possible, I'd like to know that so that I can stop wasting my time and use another product like SurveyMonkey.

  • I cannot help you with creating an in-iframe event. But I know that Wufoo enables redirection after submission, and it also works when the form is embedded as an iframe. They also have a nice API, perhaps there is an option to customize the "thank you" URL per user using JS that would help your tracking. Hope this helps.
    – dm-guy
    Commented Dec 29, 2014 at 17:01
  • I wish I knew. But I am sure there is a way.
    – closetnoc
    Commented Dec 30, 2014 at 1:50

2 Answers 2


You cannot do what you described that would technically be cross-site scripting and most browsers frown on that. What you need is a thank you page. When they finish with the form it redirects to the thank you page on your site to register the event.

That said Iframes have a SRC that is registered with the DOM if googles form has its own thank you page URI then you could create an event listener OnMouseOut or when focus of the Iframes is lost to check the SRC to see if it is on the thank you page.

  • Some pages allow JavaScript hooks to talk to an iFrame. For example there is a JavaScript API to control a YouTube video in an iFrame. Do you know if something like that exists for Google Forms? Commented Jan 17, 2015 at 15:35
  • In the case of YouTube they have event listeners in place waiting for an events to happen the results can be accessed using Youtube's Iframe api. In the case of Google forms these event listeners are not there and to my knowledge there is no Iframe API for Google. Commented Jan 17, 2015 at 15:46

I'm not sure if this will work due to the factors you listed but perhaps it'll give you a starting point for fruitful research.

I have been using Google Tag Manager and it has a built-in event that fires off on form submission (you can even set it only to fire the event to the dataLayer if the form successfully submits).

For WordPress there's an awesome plugin GTM4WP that enables even more detailed tracking of form usage (switching between fields, etc.).

Assuming, this works with an iframe, I suspect you could use Google Tag Manager to inject custom HTML (a meta-refresh perhaps) when the 'event' of successful form submission occurs.

  • I can't find any references that say that it would work with an iframe. Commented Jan 5, 2015 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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