Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Cloud Retail 標記
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本文適用於想要將 Cloud Retail 代碼從用戶端移至伺服器容器的開發人員。請參閱 Google Cloud 說明文件,瞭解 Cloud Retail 網頁容器標記。
事前準備
本指南假設您已完成下列事項:
設定 Cloud Retail 代碼
開啟 Google 代碼管理工具
在伺服器容器中,開啟「代碼」選單,然後建立「新」代碼。
在「代碼設定」中,選取「Cloud Retail」代碼。
設定 Cloud Retail 代碼:
- 在「API 金鑰」下方,輸入支援
projects.locations.catalogs.userEvents.collect 方法 的有效 Cloud Retail API 金鑰。
- 在「專案編號」下方,輸入 Cloud Retail 專案的 Google Cloud 專案編號。
- 在「要覆寫的欄位」下方,設定訪客 ID:
- 欄位選取器:
visitorId
- 欄位值:輸入可解析 GA4 事件中專屬訪客 ID 的變數,例如用戶端 ID。
- 選用:如要評估搜尋事件,請按照下列步驟操作:
- 欄位選取器:
searchQuery
- 欄位值:輸入用於擷取搜尋查詢的變數。搜尋事件的建構方式是將搜尋事件查詢與查詢的曝光次數結合,這些資料會透過
view_item_list 傳送。
在「觸發條件」中,選取代碼的觸發時機。如要瞭解 Google Analytics 4 觸發事件與 Cloud Retail 事件之間的對應關係,請參閱 Google Cloud 說明文件。
為代碼命名並儲存。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-15 (世界標準時間)。
[null,null,["上次更新時間:2024-11-15 (世界標準時間)。"],[],["Developers moving Cloud Retail tags to a server container should first ensure they have a server container, tagging server, and data flow from web to server containers established. In the server container, create a new Cloud Retail tag, configuring it with a valid API key, project number, and a visitor ID variable (e.g., client ID). Optionally, configure search event measurement using a search query variable. Finally, select appropriate triggers based on GA4 event mappings and save the tag.\n"]]