私はこのコードを持っています。コードは例外なく実行されます。
(function () {
$("a.ga-track").click(function () {
var anchor = this;
try {
_gaq.push(["_trackEvent", "External links", anchor.hostname]);
} catch (err) { }
setTimeout(function () {
document.location.href = anchor.href;
}, 100);
return false;
});
})();
これが生成する統計を見つける必要がありますか?
編集: これはサイトです http://andersmalmgren.github.io/FreePIE/
target="_blank"
タイムアウトが必要ないため、コードをこれに更新しました
(function () {
$("a.ga-track").click(function () {
var anchor = this;
try {
_gaq.push(["_trackEvent", "External links", anchor.href]);
} catch (err) {
console.log(err);
}
if ($(this).attr("target") !== "_blank") {
setTimeout(function () {
document.location.href = anchor.href;
}, 100);
return false;
}
return true;
});
})();