2012-03-02 228 views
1

我正在嘗試使用谷歌分析設置跨域跟蹤。基本上我有一個小部件,它將客戶引導到購物籃,在那裏他們可以購買物品。Google Analytics(分析)設置跨域跟蹤

我們需要給客戶一些代碼,以便將他們的收據頁面,但我有麻煩設置它。我已經建立了一個虛擬項目的兩個結構與我們的主網頁下面的代碼(這將是開發時的小部件),其具有下面的代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-27715734-3']); 
    _gaq.push(['_setDomainName', 'myDomainA.com']); 
    _gaq.push(['_setAllowLinker', true]); 
    _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> 


</head> 
<body> 


    <p>Direct to techport page &nbsp; <a href ="http://techport.e-talemarketing.co/Payment.html"onclick="_gaq.push(['_link', 'http://techport.e-talemarketing.co/Payment.html']); return false;"><input id="btnTechport" type="button" value="techport" /></a></p> 

    <p>Direct to forOffice page &nbsp; <a href ="http://foroffice.etailtesting.co.uk/Payment.html"onclick="_gaq.push(['_link', 'http://foroffice.etailtesting.co.uk/Payment.html']); return false;"><input id="btnForOffice" type="button" value="ForOffice" /></a></p> 

,並把假收據頁面上的以下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-27715734-3']); 
    _gaq.push(['_setDomainName', 'myDomainA.com']); 
    _gaq.push(['_setAllowLinker', true]); 
    _gaq.push(['_trackPageview']); 

    // add item might be called for every item in the shopping cart 
     // where your ecommerce engine loops through each item in the cart and 
     // prints out _addItem for each 
     _gaq.push(['_addItem', 
         'techport222',   // order ID - required 
         '54321',     // SKU/code - required 
         'Shiny jewels',   // product name 
         '',        // category or variation 
         '8',       // unit price - required 
         '3'  

         ]); 

     _gaq.push(['_trackTrans']); //confirms that a purchase has occurred and submits transaction to the Analytics servers 

    (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> 



</head> 
<body> 
    <p> 
     TechPort Payment receipt for item</p> 
</body> 
</html> 

當谷歌Analytics(分析)建立我的帳戶我所做的默認網址的主頁網址,以便www.MyDomainA.com。

並增加了2個不同的購物籃。

我看不到任何正在跟蹤的事件任何人都可以看到我做錯了什麼?

我已經在兩個配置文件aswel上將電子商務跟蹤設置爲true。

編輯:有一個很大的可能性我當時是不耐煩,因爲我可以看到現在的事件 - 我只是想,谷歌分析S的事件段的意思是實時...

回答

1

有多久你給了它?有時需要幾天的時間才能看到事件時,他們是第一次設置。就您的情況而言,您似乎在電子商務跟蹤開始時錯過了_addTrans方法。

_gaq.push(['_addTrans',  
     '1234',   // order ID - required 
     'Womens Apparel', // affiliation or store name 
     '28.28',   // total - required 
     '1.29',   // tax 
     '15.00',   // shipping 
     'San Jose',  // city 
     'California',  // state or province 
     'USA'    // country 
    ]); 
    ... 
    _gaq.push(['_addItem',... 

    ... 
    _gaq.push(['_trackTrans',... 

文檔在這裏 - http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._addTrans

+0

我只把他們送進現在和一些是來過它可能是確定感謝在addTrans的意見,我會補充說,看看我是否得到任何額外的東西謝謝! – user1244865 2012-03-02 14:09:47

+0

很高興我能幫到你。 'addTrans'不是可選的,它是GA電子商務工作所必需的。 – shanabus 2012-03-02 14:11:52

+0

哦,好的,謝謝,很高興知道 – user1244865 2012-03-02 14:27:25

相關問題