I want to go to the Thanks page after submit on Google form.

Asked 3 months ago, Updated 3 months ago, 6 views

▼Purpose
I would like to use Google form embedded in the inquiry page on the homepage, but I would like to transfer to a specific page (thanks page) after submit to measure the number of inquiries completed by Google Analytics.

▼What I checked
I think the following two sites are related.

·Wisdom bag
https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q14161605959
·hello-world.jp.net
https://blog.hello-world.jp.net/javascript/878/#i-2

▼What you did after checking
①Fill in the HTML entry field of the inquiry page https://example.com/contact with the following Google form tags.The contact form has been verified to be properly embedded.

<iframe src="https://docs.google.com/forms/d/e/~~~/viewform?embedded=true" width="640" height="1634" frameborder="0" marginwidth="0" marginheight="0">loading...</iframe>

サン Using the Sunks page as https://example.com/thanks as a reference, create the following code.

<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" 
style="display:none;"onload="if(submitted) 
{window.location='http://example.com/thanks'}"></iframe>
<form action="https://example.com/thanks" method="POST" id="ss-form" 
target="hidden_iframe" onsubmit="submitted=true">

▼Question
Q1. Where should I attach the above code?
Q2. Is the above code correct?

I'm sorry to ask you such an amateur question, but I appreciate your cooperation.

google-apps-script

2022-09-30 13:48

1 Answers

<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" 
style="display:none;"onload="if(submitted) 
{window.location='http://example.com/thanks'}"></iframe>

Stick the inside of the head

<form action="here's the Google form URL" method="POST" id="ss-form" 
target="hidden_iframe" onsubmit="submitted=true">

is in the body, but paste the URL of the form in action.

Also, please extract the numeric part of entry.012345← from the site and put it in the tag part of input like name="entry.012345".

I think it works like that.


2022-09-30 13:48

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.