Jak dodać śledzenie konwersji formularza contacform7 dla wordpressa?

1) Instalacja pluginu


2) Edycja KODU (przekierowanie)  NIE DZIAŁA!!

The simplest way is utilizing Contact Form 7’s custom DOM event to run JavaScript. The following is an example of script that redirects you to another URL when the wpcf7mailsent event occurs:

document.addEventListener( 'wpcf7mailsent', function( event ) {
    location = 'http://example.com/';
}, false );

Embed this snippet into your theme’s template file. Obviously, you need to replace the http://example.com/ in the code to the URL you want to redirect to.

3. event




Event Tracking

Contact Form 7’s AJAX form submission can be tracked as an event. You can send a contact form submission event to Google Analytics with the following JavaScript function call:

ga('send', 'event', 'Contact Form', 'submit');

You don’t need to edit any JavaScript files to run this code because you can utilize on_sent_ok action hook, explained in the next section.

Using on_sent_ok

Contact Form 7 provides a JavaScript action hook called “on_sent_ok” to specify a JavaScript function that you’d like to run after a form submission successfully completes.

To set the event tracking code mentioned above to the hook, open the Additional Settings tab in the contact form editor screen, and insert the following line into the field:

on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit');"

Don’t forget to quote the code properly, and make sure all of the code is on one line.

That’s it. Now, if you have set up everything correctly, Google Analytics will track successful form submissions through the contact form as an event with “Contact Form” as the event category, and “submit” as the event action.

To verify this is working correctly, you can check the Behavior > Events > Overview report page on Google Analytics 24-48 hours after a submission. At that point, you should be able to find tracked events there.





dodatkowo w sekcji head:


Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj /  Zmień )

Zdjęcie na Google

Komentujesz korzystając z konta Google. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )

Połączenie z %s