一页上有多个 goog_report_conversion 标记 - Google Adwords 转化跟踪
Posted
技术标签:
【中文标题】一页上有多个 goog_report_conversion 标记 - Google Adwords 转化跟踪【英文标题】:Multiple goog_report_conversion tags on one page - Google Adwords Conversion Tracking 【发布时间】:2015-11-09 12:16:03 【问题描述】:我在下面有 12 个相同的 sn-ps,它们都需要在同一页面上。我已经修改了它们,所以它们是 goog_report_conversion_a、goog_report_conversion_b 等等。然而,这会导致标签未经验证 - 这是将多个 sn-ps 添加到一个页面的正确方法吗?
<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>
【问题讨论】:
【参考方案1】:是的,即使 Google 无法验证(由于代码中的更改),您也可以这样做。
但是,您的代码中有很多重复,因为您必须为每个按钮复制所有这些大块一次(在您的情况下总共复制 12 次)。
我建议使用以google_conversion_id
和google_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>
【讨论】:
很好的答案。唯一的事情:在您的示例点击事件中,我认为您错过了将 URL 参数传递给 goog_conv_custom。以上是关于一页上有多个 goog_report_conversion 标记 - Google Adwords 转化跟踪的主要内容,如果未能解决你的问题,请参考以下文章