Google Analytics 改進 Tracking code 發送資料的方式, 簡單說, 就是下述兩點:
- 小於 2048 bytes 的走 HTTP GET
- 大於 2048 bytes 的走 HTTP POST
相關新聞
- 原文: Leading The Industry with Tracking Code Improvements (下述摘錄自此文)
- Traditionally, client-side tracking code beacons have been sent via HTTP GET requests, which are limited to 2048 bytes by some browsers and proxies. Requests sent to Analytics that exceeded this limit were dropped, and the data never reached Google Analytics. Starting with this release, requests longer than 2048 bytes will be sent via HTTP POST, which has no such limit. The tracking code will now support beacons up to 8192 bytes!
- This feature requires no user configuration and has been pushed in the latest version of the JavaScript tracking code. With this new capability we hope to bring you even more innovative features in the coming months.
- 中文簡體版: Google Analytics 改進跟蹤代碼發送請求方式引領統計行業發展 - 上述文章的完整翻譯
新聞內容重點摘錄
- 傳統的 Client 端 與 Tracking code 統計數據通過 HTTP GET 請求發送, 部分 Browser 與 Proxy 對該方式(HTTP GET)有 2048 bytes 的長度限制.
- 發往 Analytics 的超出該限制的請求會被丟棄, 這些統計數據將無法被 Google Analytics 收到.
- 新版 Tracking code 中, 長於 2048 bytes 的請求將通過 HTTP POST 發送, 該方式無此類限制.
- Tracking 現在支持發送的統計數據長達 8192 bytes.
- Tracking code 程式不用做更新, Google Analytics 會自動更新.
- 簡單講, 現在新版 Google analytics tracking code, 若 request 長度超過 2048 bytes, 會改用 HTTP POST 發送, 目前最長限制 8192 bytes.
- 因此有些過長的資料漏掉, 是正常的.
HTTP GET 於瀏覽器的長度限制
不過, 瀏覽器對 HTTP GET 的長度, 似乎比規範中的還要長很多, 會漏掉而沒紀錄的訊息, MIS 應該不會想看到. XD
下面把瀏覽器現在實作的 Maximum URL 長度 (HTTP GET 長度限制) 的文章做些整理:
- What's the Maximum URL length in Firefox
- Firefox 33,000 character URL (long URI)
- IE 原文: Maximum URL length is 2,083 characters in Internet Explorer
- IE 中文版: 最大 URL 長度是在 Internet Explorer 中的 2,083 字元
- What is the maximum length of a URL?
- WWW FAQs: What is the maximum length of a URL? - 有測試下述瀏覽器、Server 能承受的長度.
- Microsoft Internet Explorer (Browser) - Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters
- Firefox (Browser) - I stopped testing after 100,000 characters.
- Safari (Browser) - I stopped testing after 80,000 characters.
- Opera (Browser) - I stopped testing after 190,000 characters.
- Apache (Server) - Apache documentation only mentions an 8,192-byte limit on an individual field in a request.
- Microsoft Internet Information Server - The default limit is 16,384 characters
- Perl HTTP::Daemon (Server) - Up to 8,000 bytes will work.