我想跟踪adwords中链接的转换;为此,我有一个看起来像这样的经典代码(不要担心conversion_id和conversion_label的值):
<!-- Google Code for Joc Sloturi2 Conversion Page
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
<script type="text/javascript">
/* <![CDATA[ */
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = xxxxxxx;
w.google_conversion_label = "dsadsadsadsadadsa";
w.google_conversion_value = dsadasda;
w.google_conversion_currency = "RON";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
window.open(url, '_blank')
}
}
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>
之后出站链接看起来像这样
<a href="linkURL" onclick="goog_report_conversion('linkURL')" target="_blank">Link text whatever</a>
我的问题是,当我点击链接时,它会在新选项卡中打开链接,也会在同一个选项卡中打开(基本上它会打开链接两次);有没有办法只在浏览器的新标签页中打开链接,并跟踪它的转换?
答案 0 :(得分:0)
我知道这有点老了,但是我找到了解决方案。删除
window.location = url;