Skip to content Skip to sidebar Skip to footer

Google Adwords Conversion On Ajax Form?

We have been asked by a client to add their AdWord Conversion tracking code to a landing page following the completion of an enquiry form, the problem is the form is AJAX based so

Solution 1:

The above solution is correct.

In the head, add:

<scripttype="text/javascript"src="https://www.googleadservices.com/pagead/conversion_async.js"charset="utf-8"></script>

In the JS:

$.ajax({
    type: 'POST',
    url: "/contactSend.php",
    data: postData,
    success: function(result) {
        // CONVERSION TRACKING START window.google_trackConversion({
            google_conversion_id: XXXXXXXXX,
            google_conversion_language: "en",
            google_conversion_format: "3",
            google_conversion_color: "ffffff",
            google_conversion_label: "XXXXXXXXXXXXXXXXXX",
            google_remarketing_only: false,
            onload_callback : function() {
                console.log("Conversion Sent Contact");
            }
        });
    }
});

Post a Comment for "Google Adwords Conversion On Ajax Form?"