I found a tutorial for adding Google Conversion code to WordPress Contact Form 7 plugin which can be found here.
Currently I've added
<script type="text/javascript">
$(".wpcf7-form").submit(function(){
var google_conversion_id = "12345678910";
var google_conversion_label = "xxxxxxxxxxx";
var image = new Image(1,1);
image.src = "http://www.googleadservices.com/pagead/conversion/"+google_conversion_id+"/?label="+google_conversion_label+"&script=0";
});
</script>
to my footer, but it doesn't send correct results. Could someone help me out with what I should add to my Contact Form Plugin, through the control panel of WordPress, to make my Analytics show correct results. I would not prefer redirecting to another page.
I did this in three simple steps:
on_sent_ok: "run_conversion_code();"
In header.php (or in a js file):
functions.php
function run_conversion_code()
add_action( 'wp_ajax_run_conversion_code', 'run_conversion_code' );
add_action( 'wp_ajax_nopriv_run_conversion_code', 'run_conversion_code');
The analytic code should be like this format:
(where the last 2 parameters are optional)
So, we just need to make the Contact Form 7's Additional settings code like this:
If you want to learn more: Event tracking in WordPress Contact Form 7 (Universal Analytics) and Google Event Tracking - Web Tracking (analytics.js)
You are on right track. As this script runs you get your results recorded at server.
I have implemented the second one successfully on one of my client's website Hiteshi Technologies
If you want to set it without any redirection you may find this helpful.
Google Conversion Tracking Without Redirection
Cheers!!