• Resolved robmcp

    (@robmcp)


    Any suggestions on this?
    I note that on_sent_ok Is Deprecated and will disappear by 2017 end?
    I use it on a form completion to activate a thank you page on Additionall settings.

    THIS.
    on_sent_ok: “location = ‘https://mysite.comm/contact-and-enquiry/thank-you’;”

    The contact form 7 offers an example replacement for a Google event track but nothing like my page redirect. See below.

    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 ) {
    ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );
    }
    }, false );
    </script>
    <?php
    }

    Can anyone suggest a replacement set of code to redirect to the thank you page the above code is not much help. Thanks.
    McP.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I would like to know the same thing as I’m using re-directs after form submission for a number of different forms.

    Also, how do we construct the code above for multiple different CF forms? I guess we’d use an elseif statement for each additional form but I’m note sure what the code should look like for that.

    Thread Starter robmcp

    (@robmcp)

    Still looking for an answer on this, I really want to have a thank you page activated, Helps with Google stats.

    Thread Starter robmcp

    (@robmcp)

    Still, Still looking for an answer on this. Contact form 7 is going to stop supporting thiw end 2017. Would love to have an alternate option to send visitors to a new page on form submission.

    Thread Starter robmcp

    (@robmcp)

    Found this https://contactform7.com/redirecting-to-another-url-after-submissions/

    Add this to functions.php
    <script>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    location = ‘https://example.com/&#8217;;
    }, false );
    </script>

    This works just fine if you have only one form and one thank you page, as I did on the site I wanted to use it on. If I have sites with several forms that I wanted to track,
    Can anyone suggest a mod that will allow me to tailor this code to any Contact form, 7 form?

    Thanks, McP.

    Thread Starter robmcp

    (@robmcp)

    Thanks Pracko I don’t have another multi form site ready yet to testthis on, but are you saying that this code from the Jordanscott7 post would work on different forms?

    Would the location.replace(“/contact-confirmation”) code make that partcular form on completions by a visitor send the user to a thank you page for that form assuming one was configured?

    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
    }

    Yes, each form submission opens to a specific thank you page which is (naturally) trackable by GA on an individual page basis.

    Thread Starter robmcp

    (@robmcp)

    Thanks, I now have another multi form site I can test this on.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘on_sent_ok Is Deprecated replacement options’ is closed to new replies.