谷歌的Adwords转换脚本 [英] google Adwords conversion script
问题描述
我有一个表格,之后提交我想运行的谷歌AdWords转换脚本的形式。
I have a form, that after submit the form I want to run the script of google Adwords conversion.
我使用AJAX和jQuery:
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");
}
});
一切正常发现,警报消息是跳,在newLead.php脚本运行。 我只是没有看到谷歌的AdWords的转换。
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.
我该怎么办?
当然,我改变myConversionId和myConversionLabel我真正的细节。
Of course I changed myConversionId and myConversionLabel to my real details.
感谢
推荐答案
我刚刚送走自己的像素要求。类似下面的工作对我来说:
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.
这篇关于谷歌的Adwords转换脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!