追蹤程式碼:Urchin 伺服器

此參考資料說明當您同時使用 Google Analytics (分析) 和 Urchin 軟體追蹤網站時,用來設定伺服器的方法。

GATC Urchin 伺服器方法

方法說明

_getLocalGifPath()

_getLocalGifPath()

取得 Urchin GIF 檔案的本機路徑。詳情請參閱 _setLocalGifPath()

非同步程式碼片段 (建議)

_gaq.push(function() {
  var pageTracker = _gat._getTrackerByName(); // Gets the default tracker.
  var localGifPath = pageTracker._getLocalGifPath();
});

returns

    String 本機伺服器上的 GIF 檔案路徑。

_getServiceMode()

_getServiceMode()

傳回伺服器作業模式。本機模式的可能傳回值為 0 (傳送資料至 _setLocalGifPath() 設定的本機伺服器)、1 代表遠端模式 (傳送資料給 Google Analytics (分析) 後端伺服器),或本機和遠端模式的值則為 2。

非同步程式碼片段 (建議)

_gaq.push(function() {
 var pageTracker = _gat._getTrackerByName(); // Gets the default tracker.
 var serviceMode = pageTracker._getServiceMode();
});

returns

Number 伺服器作業模式。


_setLocalGifPath()

_setLocalGifPath(newLocalGifPath)

設定 Urchin GIF 檔案的本機路徑。如果在本機伺服器上執行 Urchin 追蹤軟體,請使用此方法。_setLocalServerMode()_setLocalRemoteServerMode() 方法會使用您在這裡指定的路徑,判斷本機伺服器本身的路徑。

非同步程式碼片段 (建議)

_gaq.push(['_setLocalGifPath', 'http://mysite.com']);

參數

String   newLocalGifPath 本機伺服器上的 GIF 檔案路徑。


_setLocalRemoteServerMode()

_setLocalRemoteServerMode()

叫用這個方法,即可將追蹤資料傳送至本機伺服器和 Google Analytics (分析) 後端伺服器。如果您在本機伺服器上執行 Urchin 追蹤軟體,並希望透過 Google Analytics (分析) 伺服器追蹤資料,請使用這個方法。在這個情況下,本機伺服器的路徑是由 _setLocalGifPath() 設定。

非同步程式碼片段 (建議)

_gaq.push(['_setLocalRemoteServerMode']);


_setLocalServerMode()

_setLocalServerMode()

叫用這個方法,僅將追蹤資料傳送至本機伺服器。如果您在本機伺服器上執行 Urchin 追蹤軟體,並希望所有追蹤資料傳送至您的伺服器,請使用這個方法。在這個情況下,本機伺服器的路徑是由 _setLocalGifPath() 設定。

非同步程式碼片段 (建議)

 _gaq.push(['_setLocalServerMode']);


_setRemoteServerMode()

_setRemoteServerMode()

Google Analytics (分析) 預設安裝會將追蹤資料傳送至 Google Analytics (分析) 伺服器。如果您已在網站上安裝 Urchin 軟體,且想要僅傳送特定追蹤資料至 Google Analytics (分析) 伺服器,請使用這個方法。

非同步程式碼片段 (建議)

_gaq.push(['_setRemoteServerMode']);