I have a form, that after submit the form I want to run the script of google Adwords conversion.
I'm using ajax and jQuery:
var dataString = 'name='+$('#name').val()+'&'+'phone='+$('#phone').val()+'&'+'mail='+$('#mail').val();
$.ajax({
type: "POST",
url: "newLead.php",
data: dataString,
success: function() {
alert('Send successfully');
var google_conversion_id = myConversionId;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "myConversionLabel";
var google_conversion_value = 0;
$.getScript("http://www.googleadservices.com/pagead/conversion.js");
}
});
Everything works find, the alert message is jump, the script in newLead.php is working. I just don't see the conversion in google adwords.
What can I do?
Of course I changed myConversionId and myConversionLabel to my real details.
Thanks
Sign in to your Google Ads account. in the top right-hand corner of your account. Under 'Measurement', click Conversions. In the conversion actions table, find the conversion action that you want to check, then look at the 'Tracking status' column in that same row.
To get started, click on the Tools and Analysis tab in Google Ads, and select Conversions from the drop-down menu, which brings up the All conversions page. Click on the Conversions tab, then click the +Conversion button to create your first conversion.
An action that's counted when someone interacts with your ad or free product listing (for example, clicks a text ad or views a video ad) and then takes an action that you've defined as valuable to your business, such as an online purchase or a call to your business from a mobile phone.
Also, app downloads and in-app purchases from Google Play, and local actions will automatically be recorded as conversions, and no tracking code is needed.
I just send off the pixel request myself. Something like the following works for me:
var img = document.createElement("img");
var goalId = 123456;
var randomNum = new Date().getMilliseconds();
var value = 100;
var label = "label";
var url = encodeURI(location.href);
var trackUrl = "http://www.googleadservices.com/pagead/conversion/"+goalId+"/?random="+randomNum+"&value="+value+"&label="+label+"&guid=ON&script=0&url="+url;
img.src = trackUrl;
document.body.appendChild(img);
That at least registers the conversion, but I'm not sure if there are any issues becuase the actual tracking script isn't loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With