gpt4 book ai didi

javascript - 一个页面上有多个 goog_report_conversion 标签 - Google Adwords 转化跟踪

转载 作者:行者123 更新时间:2023-11-29 18:02:58 25 4
gpt4 key购买 nike

下面有 12 个相同的片段,它们都需要在同一页面上。我已经修改了它们,所以它们是 goog_report_conversion_a、goog_report_conversion_b 等等。然而,这会导致标签未经验证 - 这是向一个页面添加多个片段的正确方法吗?

<script type="text/javascript">
/* <![CDATA[ */
goog_snippet_vars_a = function() {
var w = window;
w.google_conversion_id = XXXXXXXXX;
w.google_conversion_label = "XXX1";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion_a = function(url) {
goog_snippet_vars_a();
window.google_conversion_format = "3";
window.google_is_call = true;
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
<script type="text/javascript"
src="//www.googleadservices.com/pagead/conversion_async.js">
</script>

//Example click events below

<a onClick="goog_report_conversion_a()" href="/">Click Event</a>
<a onClick="goog_report_conversion_b()" href="/">Click Event</a>

最佳答案

是的,即使 Google 无法验证(因为代码中的更改),您也可以那样做。

但是您的代码中有很多重复,因为您必须为每个按钮复制所有这些大块一次(在您的情况下总共复制 12 次)。

我建议使用将 google_conversion_idgoogle_conversion_label 作为参数的包装函数。

<script type="text/javascript">
/* <![CDATA[ */
goog_conv_custom = function(conversion_id, conversion_label, url) {
var w = window;
w.google_conversion_id = conversion_id;
w.google_conversion_label = conversion_label;
w.google_remarketing_only = false;

goog_report_conversion(url);
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {

window.google_conversion_format = "3";
window.google_is_call = true;
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
</script>
<script type="text/javascript"
src="//www.googleadservices.com/pagead/conversion_async.js">
</script>

//Example click events below

<a onClick="goog_conv_custom('conversion_id_a', 'conversion_label_a')" href="/">Click Event</a>
<a onClick="goog_conv_custom('conversion_id_b', 'conversion_label_b')" href="/">Click Event</a>

关于javascript - 一个页面上有多个 goog_report_conversion 标签 - Google Adwords 转化跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33608917/

25 4 0