Support » Plugin: Easy Modal » CF7 & event tracking integration – modal doesn't close with on_sent_ok
3 years, 7 months ago
First of all, I love your plugin. I have a slight problem that I suspect will be very easy for you to address. I’m currently using Easy Modal to create CF7 Pop-up forms on my site. Everything has been working fine. However, I’m trying to add Google Analytics event tracking to the CF7 modal form. I have it setup so GA records an event after the form is successfully submitted using the on_sent_ok hook. Unfortunately, adding my GA tracking code to the CF7 additional settings area causes the modal to no longer close automatically after the form successfully submits. I suspect the GA on_sent_ok command is interfering with the modal’s ability to execute its own on_sent_ok. Here is the GA code:
"on_sent_ok: "_gaq.push(['_trackEvent', 'Landing Page Modal', 'Submit']);"
To correct this, I believe I can add a second on_sent_ok command right below the GA tracking one in order to manually call the Easy Modal close hook. Unfortunately, I don’t know enough about JS to do this. I believe it would be something like this:
But I’ve tried several variations and can’t figure it out. Can you help me call the correct overlayClose function so I can add it to my CF7 and successfully integration Google Analytics, Easy Modal, and CF7? It would be a lifesaver. Thanks a million for your help!
Thats close but the solution will change with the release of v1.2 in the next day or so. If you email me at danieliser + wizardinternetsolutions.com i will send you an advanced copy to try out.
Also you may be better off adding a function to your themes JS file that does both notify GA as well as issue the close. Somthing like this for v1.2
_gaq.push(['_trackEvent', 'Landing Page Modal', 'Submit']);
and then for your form.