Contact Form 7 Track submit fields errors - wordpress

I use this code:
<script>
document.addEventListener( 'wpcf7invalid', function( event ) {
ga('send', 'event', 'Contact Form', 'SubmitError');
}, false );
</script>
to track fileds errors.
Everthing is fine but i just want to add also the class of the filed, and track with dom-event wpcf7invalid also the class of the fileds.
Can someone help me with that?
Thank you!

Just create one thank you page in your website and after submitting the form redirect to that page using contact form 7 function. You can find in contact configuration of each form in wp-admin.
After set this you can track a lead from Google analytics which user come from contact form to thank you page those all leads.
If you try to tracking means it will help you

Related

How to implement Google Adwords Conversion track code with Contact Form 7?

How to integrate Adwords conversion code (Event snippet) in Wordpress Contact Form 7 plugin to track conversion?
Please suggest me a solution adwords experts…
You can use the DOM Events created by WPCF7 to hook in and fire the conversion hit :
document.addEventListener( 'wpcf7mailsent', function( event ) {
// The mail is now sent
gtag_report_conversion();
}, false );
Google documentation from here

WP Contact Form 7 - Display [your-name] field on a separate page

I am really hoping someone can help. Searched my heart out, but didn't seem to find anything on this.
What I want to do is:
User is in a page where cf7 is, and fills in details. I then redirect the user to a separate page using on_sent_ok: "location.replace('pageurl');"
How do I display the value of the user input name on the redirection page?
If you don't want to do any programming or need your client to be able to easily edit what is on each page of the form you can use the following plugin:
Contact Form 7 Multi-Step Forms
You can just add tags to the form builder that will separate pages. I chose this plugin because I wanted my client to be able to edit the form easily. If you use the code mentioned by purvik7373 you will need to make the updates to change form fields.
First change the on_sent_ok to:
on_sent_ok: 'my_custom_redirect();'
then create that my_custom_redirect() function in the page that displays the form:
<script>
function my_custom_redirect() {
var your_name = document.getElementById('YOUR_NAME_FIELD_ID').value; // get value from your input field (YOUR_NAME_FIELD_ID) id
var url = 'https://www.example.com/?name='+your_name+''; // your redirection url
window.location = url;
}
</script>

How to track conversions without a confirmation page

I have a form on my site that, upon a successful completion, triggers a confirmation message in a modal. I need to be able to track the conversions on this form. I think I need an event tracker here, but I can't figure out where I'd put it.
The form is at http://www.nearlynewlywed.com/a/sell
The best practice is to create a virtual page view that will simulate a "thank you" page that will trigger the goal.
Execute this JS code when the form is validated and submitted:
_gaq.push(['_trackPageview', '/your-directory/form/thank-you']);
If you use Universal Analytics, then:
ga('send', 'pageview', '/your-directory/form/thank-you');
Now the thank you page will be rendered as a pageview, which will appears on your reports and Goals' funnel visualization. Remember to set the "/your-directory/form/thank-you" as the goal destination on Google Analytics.
If I understand your question correctly, you should push and event to GA when your form is validated and it passes. That means, if every field is ok, then at the same time you send the command to open the modal window you send a ga tracking command like this.
_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed']);
You could do something like this with jQuery
$('#formId').on('submit', function(){
_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed']);
});
OR add this to your form HTML tag
<form action="action.php" onsubmit="_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed'])">

Google Analytics - track form submission

I know this is possible to track how many people have actually clicked on the submit button of form, but my form has a validation, if someones click on submit without entering a value, GA will count this, but this is not a real submission.
How do i track how many people have actually submitted the form using GA?
please let me know
thanks
You can output the GA code on success of your post request. A basic in page php example would be something like this:
if(isset($_POST)){
echo "<script>_gaq.push(['_trackEvent', 'Contact', 'Inquiry', 'Inquiry Form', 0, false]);<script>";
}
You can also use the onSubmit function. A client side solution would be this:
<form id="form-name" name="form-name" action="submission-url-goes-here" method="post"
onSubmit="_gaq.push(['_trackEvent', 'FormName', 'FormSubmit', 'FormSubmissionCompleted']);">

Google Ecommerce tracking code on site were is not thank you page

I would like to implement GA ecommerce code on my shop, but I have one problem - there is no "thank you page".
It works like client click on the button "confirm" and then appears jquery alert "thank you for buy" without reloading page etc. that`s all
Is some possibilities to implement ecommerce with full functionalists in such case?
I would suggest to bind an event listener to the button "confirm" with function which will send all ecommerce data to GA. Something like this:
$("button[name=confirm]").on("click", function(){
_gaq.push(['_addTrans',
...
]);
_gaq.push(['_addItem',
...
]);
_gaq.push(['_trackTrans']);
});

Resources