我想在点击外链时延迟页面跳转,以便Google事件跟踪有足够的时间进行。我编写了下面的代码,但我不确定如何将我的变量传递给window.location。它只是将它作为字符串"url"添加,而不是链接地址。我做错了什么?
$("a.private-product-order-button").click(function(e) {
e.preventDefault();
_gaq.push(['_trackEvent', 'Order buttons', 'Click', 'Service']);
var url = $(this).attr("href");
setTimeout(function() {
$(window.location).attr('href', 'url');
}, 200);
});