• Resolved deepesh316

    (@deepesh316)


    Hello Guys,

    I am using Contact Form 7 Plugins with multiple contact forms in my website. Recently i have seen something in plugin like Depricated Settings are using in additional settings. So I reached the following link, https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/

    But I saw example code for replacing on_sent_ok with DOM Events. But however that is only for one form. What if I have to set rules for all forms that send users to a confirmation URL? How do I configure this? Do I add more lines beginning with “if” to accommodate all the forms?

    Please provide a clean solution for the same. OR Does this plugin helps me to fix the issue? Please help me out.

    eg:

    add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );

    function mycustom_wp_footer() {
    ?>
    <script type=”text/javascript”>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    if ( ‘123’ == event.detail.contactFormId ) {
    location.replace(‘/contact-confirmation’);
    }
    }, false );
    </script>
    <?php
    }

    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Kaspars

    (@kasparsd)

    Yes, this plugin provides a dedicated redirect URL option for each form.

    Thread Starter deepesh316

    (@deepesh316)

    Hello @kasparsd,

    Thanks for that, one more query. What about on_sent_ok” in on_sent_ok: “ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );”. Since the same is already deprecated in Contact Form 7 Plugin, I found the following code.

    But since I am having multiple contact forms, it would be very difficult to wrote the function (https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/) for each forms. So will this plugin helps to do this?

    Thanks
    Deepesh Kumar R

    Plugin Author Kaspars

    (@kasparsd)

    @deepesh316 This plugin uses the new event system if you’re running the latest version of CF7, see: https://github.com/kasparsd/contact-form-7-extras/blob/de34a715a5285c263b27f33139625f0d8b9d6f45/js/controls.js#L41-L46

    Thread Starter deepesh316

    (@deepesh316)

    Hello @kasparsd,

    I didn’t get you. That means, will this suitable for my query?

    Thanks
    Deepesh

    • This reply was modified 6 years, 6 months ago by deepesh316.
    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd,

    Sorry for the trouble, Do you meant, that this one is suitable for my Query?

    in on_sent_ok: “ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );”

    Thanks

    Plugin Author Kaspars

    (@kasparsd)

    @deepesh316 What I mean is that you simply need to toggle these two checkboxes for the events to trigger automatically using the correct version of hooks in the version of CF7 you have installed:

    Control checkboxes for Google Analytics events

    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd

    Thanks for the info. Very much appreciated.

    1) How can I verify that it’s working before deploying the same in Live server. I meant, is there any google chrome extension or something like that inorder to verify the contact form submission?

    2) Why there is two checkbox option provided for Google Analytics Tracking?

    I am having Test servers, so I need to verify the same from the test server. If yes please let me know, how we can test the form submission.

    Thanks
    Deepesh

    • This reply was modified 6 years, 5 months ago by deepesh316.
    Plugin Author Kaspars

    (@kasparsd)

    1. Yes, here is the official Chrome extension for Google Analytics.

    2. One is for successful submissions while the other is for all submissions.

    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd

    Hello, I tried installing this plugin. Then removed the Contact Form 7 on_sent_ok: “ga(‘send’, ‘event’, ‘general’, ‘submit’, ‘contact-us’);” deprecated settings from Additional Settings. When checked I got only one option for Google Analytics Tracking. Please see screenshot attached: https://imgur.com/a/Omv1wjT

    Also I installed the Google Analytics Debugger Extension. But after submitting form from website, I am not able to see any output in Google Chrome Console. Please correct me If I am wrong.

    Thanks

    Plugin Author Kaspars

    (@kasparsd)

    You’re right — the settings have changed recently and there is only one checkbox which will trigger different events based on various types of form submissions:

    Trigger Google Analytics and/or Matomo (formerly Piwik) events on form submissions. This will tigger the tracking code that has been set up on the site. Track form submissions as events with category “Contact Form”, actions “Sent”, “Error” or “Submit” and label “Form Name”.

    Contact Form 7 Settings

    Here is a demo form that triggers the GA events:

    GA events being triggered in the browser console

    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd

    Yeah but why this is not working in my Contact Form 7 plugin. Do you have any idea?
    I am not using an Ad Block. Also I removed the on_sent_ok: “ga(‘send’, ‘event’, ‘general’, ‘submit’, ‘contact-us’);” from additional settings in Contact Form 7 Plugin.

    Thanks
    Deepesh

    Plugin Author Kaspars

    (@kasparsd)

    @deepesh316 Unfortunately I don’t have the capacity to debug your particular implementation.

    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd

    Do you have any idea? Please help me. All I need to do is Just Install the plugin, remove the code from Contact form additional Settings and submitted the form.
    FORM: https://bobcares.com/contact-us/

    Thanks
    Deepesh

    • This reply was modified 6 years, 5 months ago by deepesh316.
    Thread Starter deepesh316

    (@deepesh316)

    @kasparsd

    How can I change the “events with category” name

    eg: Track form submissions as events with category “Contact Form”, actions “Sent”, “Error” or “Submit” and label “Custom development quote”.

    I need to change it to

    ga(‘send’, ‘event’, ‘industry-expertise’, ‘submit’, ‘custom-dev-quote’); instead of the default one created by the plugin ga(“send”, “event”, “Contact Form”, “Submit”, “Custom development quote”)

    Is this possible?

    Thanks
    Deepesh

    Plugin Author Kaspars

    (@kasparsd)

    @deepesh316 It is not possible to change the action names and labels.

    • This reply was modified 6 years, 5 months ago by Kaspars.
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘On Sent Ok DOM Events for Multiple Contact Forms’ is closed to new replies.