2010-03-24 25 views
1

繼承人我的傳奇 - 我試圖將http://www.example.com鏈接到我的購物車https://secure.example.com,但它並未似乎正確鏈接。嘗試將http://www.example.com鏈接到https://secure.example.com上的購物車

繼承人我的代碼:

<!--Google Analytics --> 
<script type="text/javascript"> 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 
</script> 
<script type="text/javascript"> 
try { 
var pageTracker = _gat._getTracker("UA-125xxxxx-1"); 
//start cart link 
pageTracker._setDomainName(".example.com"); 
pageTracker._setAllowHash(false); 
//end cart link 
pageTracker._trackPageview(); 
} catch(err) {}</script> 
<!--Google Analytics --> 

注意兩條線:

pageTracker._setDomainName(".example.com"); 
pageTracker._setAllowHash(false); 

我添加的第一線,所以我可以分享網站和購物車之間的餅乾,並添加setAllowHash確保它使用cookie中的utm值,並且當我輸入https://secure.example.com時沒有'重新創建'它們。

使用firecookie,它確實在網站和購物車之間共享相同的cookie,cookie域爲'example.com'。

雖然我很確定,如果它正常工作,我所有的utmz,utma值等應該被複制並保持不變,但它們正在改變。我已經複製了所有發送到谷歌分析並粘貼在下面的參數。它顯示了從我的主頁,到我的產品頁面,然後到訂購之前到購物車的所有內容。 (我不能實際測試自己的最後一頁不買東西,所以我會發布後,如果需要從我們的確認頁面的代碼。)

這裏所說:

=============================================================== 
HOMEPAGE - http://www.example.com 
---------------------------------------------------------------------------------------- 
utmac UA-125xxxxx-1 
utmcc __utma=1.1920057171.1269446996.1269446996.1269446996.1;+__utmz=1.1269446996.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); 
utmcs UTF-8 
utmdt GSM Cell Phone Rental from example 
utmfl 10.0 r45 
utmhid 69978133 
utmhn www.example.com 
utmje 1 
utmn 1806413990 
utmp/
utmr - 
utmsc 24-bit 
utmsr 1280x800 
utmul en-gb 
utmwv 4.6.5 

PRODUCT PAGE - http://www.example.com/products/international-cell-phone-purchase/ 
---------------------------------------------------------------- 
utmac UA-125xxxxx-1 
utmcc __utma=1.1920057171.1269446996.1269446996.1269446996.1;+__utmz=1.1269446996.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); 
utmcs UTF-8 
utmdt example | International Cell Phones 
utmfl 10.0 r45 
utmhid 276151647 
utmhn www.example.com 
utmje 1 
utmn 155808433 
utmp /products/international-cell-phone-purchase/ 
utmr 0 
utmsc 24-bit 
utmsr 1280x800 
utmul en-gb 
utmwv 4.6.5 

CART STAGE 1 - https://secure.example.com/checkout/viewbasket.php 
------------------------------------------------ 
utmac UA-125xxxxx-1 
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/; 
utmcn 1 
utmcs UTF-8 
utmdt Your Cart 
utmfl 10.0 r45 
utmhid 1802074903 
utmhn secure.example.com 
utmje 1 
utmn 1621444199 
utmp 1-reviewcart 
utmr http://www.example.com/products/international-cell-phone-purchase/ 
utmsc 24-bit 
utmsr 1280x800 
utmul en-gb 
utmwv 4.6.5 

CART STAGE 2 - https://secure.example.com/checkout/docheckout.php 
------------------------------------------------ 
utmac UA-125xxxxx-1 
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/; 
utmcs UTF-8 
utmdt Checkout 
utmfl 10.0 r45 
utmhid 871670520 
utmhn secure.example.com 
utmje 1 
utmn 1153927228 
utmp 2-checkout 
utmr 0 
utmsc 24-bit 
utmsr 1280x800 
utmul en-gb 
utmwv 4.6.5 

CART STAGE 3 - https://secure.example.com/checkout/doreview.php 
---------------------------------------------- 
utmac UA-125xxxxx-1 
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/; 
utmcs UTF-8 
utmdt Checkout 
utmfl 10.0 r45 
utmhid 1731598159 
utmhn secure.example.com 
utmje 1 
utmn 1442257710 
utmp 3-checkoutreview 
utmr 0 
utmsc 24-bit 
utmsr 1280x800 
utmul en-gb 
utmwv 4.6.5 
=============================================================== 

正如你所看到的, utma值沒有被保存,所以它看起來像一個配置問題。我研究過這個幫助,但沒有一個案例似乎適合我。

我希望有人能爲此提供幫助,這是我一段時間以來的一個持續問題,並且最終能夠成功建立堅如磐石的可靠分析。

+0

嗨,你能不能從您的購買收據頁面發佈GA代碼(修改GATC)(即頁面,您初始化交易對象?好的,如果只是差異 – doug 2010-03-24 20:16:17

+0

繼承人一個pastebin,它已經包含電子商務的東西。這似乎記錄在分析中,它只是網站'鏈接' http://pastebin.com/xQGF6sk0 – 2010-03-25 09:52:38

回答

1

其實我已經得到了它現在的工作使用下列內容:

<!--Google Analytics Asynchronous Code --> 
<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(
    ['_setAccount', 'UA-xxxxxxxx-1'], 
    ['_setDomainName', '.domain.com'], 
    ['_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> 
<!--Google Analytics Asynchronous Code END--> 
1

(我假設你已經啓用了電子商務在個人資料設置報告。)

我相信你缺少一些樣板(更詳細的介紹了一下)。此外,您在問題文本中提到的兩條線(在「開始購物車鏈接」和「結束購物車鏈接」之間是沒有必要的)

在呼叫_trackPageview之後,您需要三條額外的線路,其中兩條更新分別保存交易和商店項目數據的數組,以及最後一行來調用_trackTrans()。這是您需要將您的信息發送到GA服務器的呼叫:

因此,在調用_trackPageview之後,插入這三行:

pageTracker._addTrans();  // initializes a trans obj; stores trans data  
pageTracker._addItem();   // array holding data for each item in the cart 
pageTracker._trackTrans();  // confirms purchase, finalizes transaction 

對_trackTrans調用沒有任何傳遞,但是您將傳遞參數給t他上面有兩個函數調用。請記住,兩個函數的參數列表都是按位置匹配的,所以最好使用佔位符來指定不使用的參數。以下是顯示參數列表的頁面link

+0

謝謝,但爲什麼這兩條線是不必要的?我怎樣才能讓我的網站和購物車被視爲一個實體? – 2010-03-25 09:53:33

1

它看起來像你從購物車中的子域失蹤的JS以下行:

pageTracker._setDomainName(".example.com"); 
pageTracker._setAllowHash(false); 

的setDomainName設置cookie域,setAllowHash(假)變成域哈希在開始utma cookie爲'1'而不是域名的數字散列 - 在這種情況下,它並不是真正需要的,因爲購物車與主站點位於同一基本域,但如果您更改了所有以前的用戶cookie,不匹配。

不要因爲cookie值太興奮(如果您修復了這些問題,您將會看到舊的&新的cookie),請使用Firebug Net Panel進行測試以查看真正返回GA的內容。

相關問題