• Resolved rogermanich

    (@rogermanich)


    I recently want to use DCOM wpcf7submit to my contact form. I add to the head section the code explained in the documentation.

    <script>
    document.addEventListener( 'wpcf7submit ', function( event ) {
      location = ' https://mysite.com/thank-you';
    }, false );
    </script>

    When I use the form I receive the email but the event looks like it never runs. I don’t know If I need to add something to my form in order to use this listener or it is something that works automatically by the plugin.

    I use the last version of wordpress and the plugin.

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter rogermanich

    (@rogermanich)

    https://cosesquemagraden.com

    The contact us section contains the form.

    thank you @takayukister

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter rogermanich

    (@rogermanich)

    Yes it is. Sorry, I should write the URL.

    I put a breakpoint into the listener but it looks like the event never runs.

    Thread Starter rogermanich

    (@rogermanich)

    I added, just for test, the same listener with submit “event”

    <script>	
    document.addEventListener('submit', function( event) {
      ga('send', 'event', 'Contact Form', 'submit');
    }, false );
    </script>

    And this one works. SO I guess you don’t trigger the event or my template do something that avoir to trigger this event. Not sure.

    Thread Starter rogermanich

    (@rogermanich)

    For the moment I add this custom code. It is not the best but allows me to handle several contact forms from the same listener. If I did something wrong, let me know, please.

    <script>	
    document.addEventListener('submit', function( event) {
      const form = document.getElementsByClassName("w-form")[0];
    	action = form.getAttribute("action");
    	if (action=="https://cosesquemagraden.com/contact-us/") {
    		ga('send', 'event', 'Contact Form', 'submit');
    	}
    }, false );
    </script>
    Thread Starter rogermanich

    (@rogermanich)

    sorry … ??
    I eventually found the problem. By Mistake I was using contact element instead of contact7 element. My mistake. Sorry.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Contact7 DCOM wpcf7submit doesn’t work?’ is closed to new replies.