試用 Google Analytics 的 MCP 伺服器。從
GitHub 安裝,詳情請參閱
公告。
盡快填補 Google Ads 流量來源資料 (GA 360)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如果您使用 BigQuery 每日更新匯出功能,部分 traffic_source
欄位可能會顯示 Data Not Available
。本指南可協助您在現有匯出資料中,自動填補缺少的大部分流量來源資料,通常會在每天凌晨 5 點前完成。
自動填補的步驟如下:
- 監聽 BigQuery 每日完整性信號。
- 找出 BigQuery 匯出資料中缺少流量來源資料的事件。
- 查詢 Google Ads 中這些事件的完整資料。
- 將完整的事件資料與 BigQuery 匯出資料彙整。
建立 Pub/Sub 主題
- 在 Google Cloud 控制台的左側導覽選單中,開啟「Pub/Sub」。如果找不到「Pub/Sub」,請在 Google Cloud 控制台搜尋列中搜尋:

- 在「主題」分頁中,按一下「+ 建立主題」:

- 在「Topic ID」欄位中輸入名稱。
- 選取「Add a default subscription」(新增預設訂閱),其他選項請留空白:

- 按一下「建立」。
建立 Log Router 接收器
- 在 Google Cloud 控制台中開啟「Log Router」:

- 按一下「Create Sink」(建立接收器):

- 輸入集區的名稱和說明,然後按一下「下一步」。
- 選擇「Cloud Pub/Sub 主題」做為接收器服務。
- 選擇您建立的主題,然後按一下「下一步」。
在「Build inclusion filter」中輸入以下程式碼:
logName="projects/YOUR-PROJECT-ID/logs/analyticsdata.googleapis.com%2Ffresh_bigquery_export_status"
將 YOUR-PROJECT-ID 替換為 Google Cloud 控制台專案的 ID。
依序點選「Next」和「Create Sink」。您不需要篩除任何記錄。
確認接收器現在是否列在「Log Router Sinks」下方。
彙整缺少的資料
使用 Cloud Run 函式自動執行程式碼,在 Pub/Sub 偵測到完整性信號時回填流量來源資料:
- 開啟 Cloud Run 函式:

- 按一下「CREATE FUNCTION」:

- 在「環境」中,選擇「Cloud Run 函式」。
- 輸入函式名稱。
- 選擇「Cloud Pub/Sub」做為「觸發條件類型」,並將您建立的主題設為「Cloud Pub/Sub 主題」。
- 按一下「Next」(下一步),然後輸入代碼,即可在方塊中將 Google Ads 歸因資料與 BigQuery 匯出資料結合。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-19 (世界標準時間)。
[null,null,["上次更新時間:2024-12-19 (世界標準時間)。"],[],["The core process addresses missing traffic source data in BigQuery Fresh Daily exports. It involves listening for a daily completeness signal via Pub/Sub, identifying incomplete events, and then querying Google Ads for the complete data. This complete data is then joined with the existing BigQuery export. To achieve this, a Pub/Sub topic and a Log Router sink are created to monitor the completeness signal. Finally, a Cloud Run function is employed to execute the data backfill using a custom code when triggered by the completeness signal.\n"],null,["# Backfill Google Ads traffic source data as soon as possible (GA 360)\n\nIf you use BigQuery Fresh Daily exports, you might see `Data Not Available` for\nsome `traffic_source` fields. This guide helps you automatically backfill most\nof the missing traffic source data in existing exports as soon as it's\navailable, typically by 5 AM each day.\n\nHere are the steps to automate the backfill:\n\n1. Listen for the daily completeness signal from BigQuery.\n2. Identify the events with missing traffic source data in your BigQuery export.\n3. Query the complete data for those events from Google Ads.\n4. Join the complete event data with your BigQuery export.\n\nCreate a Pub/Sub topic\n----------------------\n\n1. Open **Pub/Sub** in the left navigation menu of the [Google Cloud console](https://console.cloud.google.com/). If you don't see **Pub/Sub** , search for it in the Google Cloud console search bar:\n2. Click **+ CREATE TOPIC** in the **Topics** tab:\n3. Enter a name in the **Topic ID** field.\n4. Select **Add a default subscription** , leave the other options blank:\n5. Click **Create**.\n\nCreate a Log Router sink\n------------------------\n\n1. Open **Log router** in the Google Cloud console:\n2. Click **Create sink** :\n3. Enter a name and description for your sink, then click **Next**.\n4. Choose **Cloud Pub/Sub topic** as the sink service.\n5. Choose the topic you created, then click **Next.**\n6. Enter the following code in **Build inclusion filter**:\n\n logName=\"projects/\u003cvar translate=\"no\"\u003eYOUR-PROJECT-ID\u003c/var\u003e/logs/analyticsdata.googleapis.com%2Ffresh_bigquery_export_status\"\n\n Replace \u003cvar translate=\"no\"\u003eYOUR-PROJECT-ID\u003c/var\u003e with the ID for your Google Cloud console\n project.\n7. Click **Next** , then click **Create sink**. You don't need to filter out any\n logs.\n\n8. Verify the sink is now listed under **Log Router Sinks**.\n\nJoin the missing data\n---------------------\n\nUse a Cloud Run function to automatically execute the code to backfill traffic\nsource data when Pub/Sub detects the completeness signal:\n\n1. Open **Cloud Run functions** :\n2. Click **CREATE FUNCTION** :\n3. Choose **Cloud Run function** for the **Environment**.\n4. Enter a name for your function.\n5. Choose **Cloud Pub/Sub** as the **Trigger type** , and the topic you created as the **Cloud Pub/Sub topic**.\n6. Click **Next**, then enter your code to join the Google Ads attribution data with your BigQuery export in the box."]]