同一页面上有多个 Google Adwords 转化标签
我可以在一个网页上使用多个 Google AdWords 转化标签吗?看起来 javascript 变量只会互相覆盖。
如果我删除 javascript 变量并只保留 noscript 链接会怎么样?
转换 1
var google_conversion_id = 123;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "666666";
var google_conversion_label = "abc";
var google_conversion_value = 0;
转换 2:
var google_conversion_id = 456;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "000000";
var google_conversion_label = "def";
var google_conversion_value = 0;
后跟 script 标签:
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
和示例 noscript 标签:
<div style="display:inline;"><img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/..."/>
</div>
Can I have more than one google adwords conversion label on a single web page? It looks like the javascript variables would just overwrite each other.
What if I remove the javascript variables and just keep the noscript link?
conversion 1
var google_conversion_id = 123;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "666666";
var google_conversion_label = "abc";
var google_conversion_value = 0;
conversion 2:
var google_conversion_id = 456;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "000000";
var google_conversion_label = "def";
var google_conversion_value = 0;
followed by script tag:
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
and sample noscript tags:
<div style="display:inline;"><img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/..."/>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对我们有用的只是包含整个代码块(包括
What worked for us was just including the entire block of code (including the
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
tag itself) twice. Because the script tag contains code which is executed immediately, including it twice will cause it to execute twice - each time using the variables declared immediately before it.JavaScript 函数。
设置您的 Google 变量。
示例 1:在 HTML 中调用。
示例 2:在事件处理程序中调用。
示例3:jQuery Ajax 成功调用后调用。
示例 4:锚点元素上的硬编码 OnClick 事件
The Javascript function.
Set your Google variables.
Example 1: Call within HTML.
Example 2: Call within an event handler.
Example 3: Call after jQuery Ajax success call.
Example 4: Hard-coded OnClick event on Anchor Element
请注意,自 2017 年 10 月起,您可以(并且应该)使用 Google 的新 gtag.js,这是一个新的网络标记库,取代了旧的 AdWords 网站转化跟踪和再营销标记。
gtag.js 允许您将跟踪数据发送到多个 AdWords 帐户,方法是为您将使用的每个帐户添加对“config”命令的调用,并指定每个帐户的转化 ID:
这是现代解决方案应遵循的模式。
Note that as of October 2017, you can (and should) use Google's new gtag.js, which is a new web tagging library that replaces the older AdWords website conversion tracking and remarketing tags.
gtag.js allows you to send tracking data to multiple AdWords accounts by adding a call to the ‘config’ command for every account you’ll be using, specifying each account’s conversion ID:
This is the pattern that modern solutions should follow.
您需要在每组变量下方插入标签
// 第二个变量槽
// 你不再需要 'var' 语句
或者你只插入 noscript 标签的内容,但没有(大部分与 javascript 标签一样好)
You need to insert the tag below each group of variables
// second slot of variables
// you don't need 'var' statement anymore
Or you insert on only the content of the noscript tag, but without (is mostly as good as the javascript tag)