我正在努力測量我的Google Adwords廣告系列和轉到App Store的正常流量的轉化情況。之前我在我的頁面上加載了一個「/ app_store /」鏈接,等待1秒鐘,然後繼續到應用商店。谷歌分析和Adwords延遲JavaScript鏈接到App Store被忽略?
我在使用Javascript的地方找到了更優雅的解決方案。對於adwords,它會加載一個像素圖像,對於分析,它會調用Google Javascript函數,暫停一小會兒,然後跟隨鏈接。
不幸的是,它不適合我。谷歌分析和谷歌Adsense沒有看到任何人去App Store(甚至不是我自己)。
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18180332-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function recordOutboundLink(link, category, action) {
try{
// Google Analytics
var pageTracker = _gat._getTracker("UA-18180332-1");
pageTracker._trackEvent(category, action);
// Google Adwords
var image = new Image(1, 1);
image.src = "http://www.googleadservices.com/pagead/conversion/1046551421/?value=$8&label=zqrfCMWh0QEQ_baE8wM&guid=ON&script=0"
setTimeout('document.location = "' + link.href + '"', 100)
} catch(err) {}
}
</script>
,並顯示鏈接:
<a href="http://itunes.apple.com/ae/app/isimplifiedchinese/id377690407?mt=8"
onClick="recordOutboundLink(this, 'Outbound Links', 'http://itunes.apple.com/ae/app/isimplifiedchinese/id377690407?mt=8');return false;">
<img alt="Appstore" src="images/appstore.png"></a>
什麼我錯在這裏做什麼?
更新23:13 我注意到,如果延遲爲100ms,由下面的錯誤閃爍(我花了一段時間的截圖)。
我只有二萬的建議測試這一點;不知道它是否也發生在舊版本中。這個錯誤似乎消失了更長的延遲;我將它設置爲300ms以保證安全。
謝謝,但我已經在使用「return false;」 (它有點隱藏,只能向右滾動) – 2011-02-23 15:21:03