5
I’m using the Google Forms to do a satisfaction survey on a site. On this site I show a bar at the top, asking the user to participate. If he closes the message, a cookie is saved that expires in 24 hours so that he no longer sees the message that day.
I would like to record a cookie if the user responds to the questionnaire so that he no longer sees the message on the site.
Someone knows a way to do it?
Editing: I can record the cookie with jQuery.
Is there any way to get the form click event? Via javascript or jquery. It is in an iframe and I can’t use jquery, for example, and catch the click event.
Iframe:
<iframe src="endereco_do_form" width="955" height="700" frameborder="0" marginheight="0" marginwidth="0">Carregando...</iframe>
Jquery:
<script>
$('#ss-submit').click(function(e){
e.preventDefault();
alert("OK")
});
</script>
#ss-Submit is the button id. I got it from devtools.
– buback
I saw that I cannot take the event because of the policies of the same origin. Does anyone know any way to do this?
– buback
From what I understand, you cannot interact with the content of an iframe coming from a domain other than your website. But you can create a CLOSE button outside the iframe and save the cookie valid for 24h. In case the user responds to the search, you need a Google callback with the search ID that will be sent to your site so that you identify this and record a cookie with "unlimited" validity so that the search no longer appears to that user.
– Sam