2012-03-02 134 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

相关问题