I'm trying to trigger a Google Adwords conversion using jQuery but not having any luck. Here's the code i'm using.
The code is used to submit a form, which is then emailed to me. The only part which does not work is the Google Conversion.
$.post('submit.php', $("form#easy").serialize(), function (data) {
if (data == "Message sent")
{
$("div#error").hide();
$("div#success").slideDown("fast");
//Scroll to top of #form div - Useful if you have a fixed header
var destination = $('div#form').offset().top - 0; //If you are using fixed header, change 0 to any height you wish
$("html:not(:animated),body:not(:animated)").animate({
scrollTop: destination
}, 200);
// Clear form data
$("#easy").reset();
//Reload captcha when message is sent
$('#vimage').attr('src', $('#vimage').attr('src')+'?'+Math.random());
// Track conversion
var google_conversion_id = "1016403774";
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "wgx7CNj0vVYQvq7U5AM";
var google_remarketing_only = false;
$.getScript("http://www.googleadservices.com/pagead/conversion.js");
} else {
//PHP validation
$("div#error").html(data).slideDown("fast");
//Scroll to top of this div - 70px from the top of your view, change this to whatever number you wish
var destination = $('div#form').offset().top - 70;
$("html:not(:animated),body:not(:animated)").animate({
scrollTop: destination
}, 200);
}
});
return false;
Any ideas what could be wrong?
Thanks, Bradley