PHP 5 已終止支援,並將於 2026 年 1 月 31 日
淘汰。淘汰後,您將無法部署 PHP 5 應用程式,即使貴機構先前曾使用機構政策重新啟用舊版執行階段的部署作業,也無法部署。現有的 PHP 5 應用程式在
淘汰日期後仍會繼續執行並接收流量。建議您
改用系統支援的最新 PHP 版本。
與 Google Analytics 整合
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Analytics 平台可讓您評估使用者在各種裝置和環境中與貴公司互動的情形。這個平台提供收集、儲存、處理及回報這類使用者互動資料所需的一切運算資源。
在用戶端和伺服器端都能進行分析資料收集作業。Google Analytics 提供簡單好用的 API 和 SDK,方便您傳送資料至 Google Analytics。此外,我們還開發了可在 App Engine 應用程式中使用的程式碼,讓您輕鬆傳送伺服器端分析資料至 Google Analytics。
收集用戶端分析資料
您可以使用資料收集 API 和 SDK,評估使用者與您的內容和行銷活動互動的情形。實作這些 API 和 SDK 後,您就能透過 Google Analytics 或 Reporting API 查看使用者互動資料。如要進一步瞭解用戶端的分析數據收集,請依照用戶端類型選取下列相關連結:
收集 App Engine 伺服器端分析資料
雖然 App Engine 提供在應用程式中記錄事件的機制,但在 Google Analytics 中追蹤特定伺服器端事件或許對您更有利。以下列舉一些好處:
- 歷史資料分析:App Engine 可讓您設定記錄檔的天數上限或大小。超過天數上限後,您就無法再存取記錄檔。但如果您使用 Google Analytics 追蹤事件,過去事件的效期會更長,您也能夠查看更久以前的記錄。
- 追蹤重要事件:由於應用程式的各種元件會將資料寫入記錄檔,因此這些檔案可能相當繁雜。事件追蹤功能可以讓您只鎖定想監控的重要事件,然後追蹤這些事件和一些其他中繼資料。
- 強大的使用者介面:Google Analytics 提供豐富的使用者介面,可用於透過視覺效果呈現、回報及匯出伺服器端事件。
如要進一步瞭解這個做法,請參閱 Google Analytics 開發人員指南的「事件追蹤」部分。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThe Google Analytics Platform provides the infrastructure to collect, store, process, and report on user interactions across various devices and environments.\u003c/p\u003e\n"],["\u003cp\u003eAnalytics collection can occur on both the client and server sides, with Google Analytics offering APIs and SDKs for easy data transmission.\u003c/p\u003e\n"],["\u003cp\u003eClient-side tracking options include Web Tracking, Android and iOS app tracking, and the Measurement Protocol for versatile environment tracking.\u003c/p\u003e\n"],["\u003cp\u003eServer-side event tracking in Google Analytics offers long-term data retention, focused tracking of key events, and a powerful user interface for data analysis compared to traditional logging.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Reporting APIs to view the user interaction data that was collected.\u003c/p\u003e\n"]]],[],null,["# Integrating with Google Analytics\n\nThe [Google Analytics Platform](/analytics/devguides/platform)\nlets you measure user interactions with your business across various devices and\nenvironments. The platform provides all the computing resources to collect,\nstore, process, and report on these user-interactions.\n\n[Analytics collection](/analytics/devguides/collection)\ncan take place on both the client and server side. Google Analytics provides\neasy to use APIs and SDKs to send data to Google Analytics. In addition to\nthose, we have developed code that you can use in your App Engine applications\nto easily send server-side analytics to Google Analytics.\n\nClient-side analytics collection\n--------------------------------\n\nWith the collection APIs and SDKs, you can measure how users interact with your\ncontent and marketing initiatives. Once implemented, you will be able to view\nuser-interaction data within Google Analytics or through the Reporting APIs.\nFor more details on client-side analytics collection select the link\nbelow based on the type of your client:\n\n- [Web Tracking (analytics.js)](/analytics/devguides/collection/analyticsjs) - Measure user interaction with websites or web applications.\n- [Android](/analytics/devguides/collection/android) - Measure user interaction with Android applications.\n- [iOS](/analytics/devguides/collection/ios) - Measure user interaction with iOS applications.\n- [Measurement Protocol](/analytics/devguides/collection/protocol/v1) - Measure user interaction in any environment with this low-level protocol.\n\nApp Engine server-side analytics collection\n-------------------------------------------\n\nAlthough App Engine already provides a mechanism for\n\n[logging events](/appengine/docs/legacy/standard/php/logs)\n\nin your application, it may be advantageous to track specific server-side events\nin Google Analytics. Some of the benefits are as follows:\n\n- **Historical data analysis** - App Engine allows you to configure the maximum number of days, or size of your log file. After that time has passed you no longer have access to those log files. Tracking events in Google Analytics provides you a much longer lifespan into the visibility of past events.\n- **Track key events** - Log files can be verbose with various components of your application writing data to them. By using event tracking you can pinpoint just the key events that you are interested in monitoring and track those along with some additional metadata.\n- **Powerful user interface** - Take advantage of the rich user interface that Google Analytics provides to visualize, report and export these server side events.\n\nFor additional information\non this approach consult the Google Analytics developers guide for\n[Event Tracking](/analytics/devguides/collection/protocol/v1/devguide#event).\n\n\u003cbr /\u003e"]]