我有一个表单,提交表单后我想运行google Adwords转换脚本.
我正在使用ajax和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的转换.
我能做什么?
当然,我将myConversionId和myConversionLabel更改为我的真实细节.
谢谢
解决方法
我只是自己发送像素请求.类似下面的东西对我有用:
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);
至少注册转换,但我不确定是否有任何问题,因为没有加载实际的跟踪脚本.