WordPress.org

Ready to get started?Download WordPress

Forums

Easy Modal
[resolved] CF7 & event tracking integration - modal doesn't close with on_sent_ok (2 posts)

  1. lynxmarketing
    Member
    Posted 1 year 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:

    "on_sent_ok: "$eModal.overlayClose();"

    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!

    http://wordpress.org/plugins/easy-modal/

  2. danieliser
    Member
    Plugin Author

    Posted 1 year ago #

    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

    function modal_form_success()
    {
    	_gaq.push(['_trackEvent', 'Landing Page Modal', 'Submit']);
    	jQuery('.modal.active').emodal('close');
    }

    and then for your form.
    on_sent_ok: modal_form_success()

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic