我正在尝试使用jquery在页面上加载Google重新标记标记脚本。它将脚本正确地附加到DOM中,但似乎在加载页面时它不会触发google脚本。
以下是我到目前为止尝试的代码。
var google = google || {};
google.remarketingtag = new function () {
this.init = function () {
var RemarketingTag = "";
RemarketingTag = '<script type="text/javascript">' +
'/* <![CDATA[ */ \n' +
'var google_conversion_id = 396654566;\n' +
'var google_custom_params = window.google_tag_params;\n' +
'var google_remarketing_only = true;\n' +
'/* ]]> */' +
'</script>';
RemarketingTag += '<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script>';
RemarketingTag += '<noscript> \n' +
'<div style="display:inline;"> \n' +
'<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/995380491/?value=0&guid=ON&script=0"/> \n' +
'</div> \n' +
'</noscript>';
$("body").append(RemarketingTag);
$.getScript("//www.googleadservices.com/pagead/conversion.js");
}
}
当我直接在页面上插入谷歌重新营销脚本时,它可以很好地运作。
请帮助,提前致谢