2016-06-09 21 views
0

我們想要跟蹤從我們的主站點發送到第三方站點的用戶是否已彈跳或點擊「註冊」 他們願意將我們的Google Analytics代碼放入他們的頁面 - 產品和註冊。 我看了一下Google提出的建議,但並不清楚幾件事情。Google Analytics(分析) - 將第三方購物車添加到主要域名報告中

我們在我們的網站目前的代碼:由谷歌提出

<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-nnnnn-1']); 
    _gaq.push(['_setDomainName', 'none']); 
    _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); 
    })(); 

</script> 

代碼作爲第三方網站:

<script> 
var _gaq = _gaq || []; 
_gaq.push(['_setAccount', 'UA-12345-1']); 
_gaq.push(['_setDomainName', 'my-example-blogsite.com']); 
_gaq.push(['_setAllowLinker', true]); 
_gaq.push(['_trackPageview']); 
</script> 
... 
<a href="http://dogs.example-petstore.com/intro.html" 
    onclick="_gaq.push(['_link', 'http://dogs.example-petstore.com/intro.html']); return false;"> 
    See my pet store</a> 

我們的代碼在這一行「無」:_gaq.push (['_setDomainName','none']);

谷歌的示例代碼的URL是

_gaq.push(['_setDomainName', 'my-example-blogsite.com']); 

什麼關係呢?我是否需要按照建議輸入域名?

而且谷歌的代碼中有一個鏈接返回到我們的網站如下

onclick="_gaq.push(['_link', 'http://dogs.example-petstore.com/intro.html']); return false;" 

我們是否需要有一個鏈接回來?我們可以刪除onclick代碼還是會影響報告? 謝謝! Myalo

回答

0

您需要onclick事件。什麼是「裝飾」鏈接,即它將需要傳遞到另一個域的url參數(它們被Google代碼拾取並用於繼續會話的地方)添加。

請注意,您使用的代碼是可怕的過時。儘可能切換到當前版本(Universal Analytics)。雖然Universal Analytics上的跨域跟蹤工作原理相同,但它更加優雅(使用單個參數而不是用於傳統GA的笨重查詢字符串),並提供了許多輔助函數以使跨域跟蹤更容易。

相關問題