I’m trying to figure out the syntax for having a google adwords conversion tracking code fire when the user submits a form. Instead of having the users go to a confirmation page, I’m using a jquery .ajax request to process the form and then return back to the form and show a confirmation message.
Here is my query
$("#contact").submit(function (e) {
….
function isValidEmail(emailAddress) {… };
if (isValidEmail(email) && (text.length > 10) && (name.length > 1)) {
$.ajax({
type: "POST",
url: "ajax/process.php",
data: dataString,
success: function () {
$('.success').fadeIn(1000).delay(3000).fadeOut(1000);
// need to fire event here
}
});
} else {
$('.error').fadeIn(1000).delay(5000).fadeOut(1000);
}
return false;
});
here is the google tracking code
<!-- Google Code for Appointment Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "xkEhCNTV8AkQnKD20wM";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/xxxxxxxxx/?label=xkEhCNTV8AkQnKD20wM&guid=ON&script=0"/>
</div>
</noscript>
Can someone help me with the syntax here?