Google 広告のトラフィック ソース データをできるだけ早くバックフィルする(アナリティクス 360)
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
BigQuery の毎日(高頻度)エクスポートを使用すると、一部の traffic_source
フィールドに Data Not Available
が表示されることがあります。このガイドでは、既存のエクスポートで不足しているトラフィック ソース データのほとんどを、利用可能になり次第(通常は毎日午前 5 時までに)自動的にバックフィルする方法について説明します。
バックフィルを自動化する手順は次のとおりです。
- BigQuery から毎日完全性シグナルをリッスンします。
- BigQuery Export で、トラフィック ソース データがないイベントを特定します。
- Google 広告から、それらのイベントの完全なデータをクエリします。
- 完全なイベントデータを BigQuery Export と結合します。
Pub/Sub トピックの作成
- Google Cloud コンソールの左側のナビゲーション メニューで [Pub/Sub] を開きます。[Pub/Sub] が表示されない場合は、Google Cloud コンソールの検索バー(
)で検索します。
- [トピック] タブで [+ トピックを作成] をクリックします。
![[トピックを作成] ボタン](https://developers.google.cn/static/analytics/bigquery/images/create-topic.png?hl=ja)
- [トピック ID] フィールドに名前を入力します。
- [デフォルトのサブスクリプションを追加する] を選択し、他のオプションは空白のままにします。

- [作成] をクリックします。
ログルーター シンクを作成する
- Google Cloud コンソールで [ログルーター] を開きます。

- [シンクを作成] をクリックします。

- シンクの名前と説明を入力し、[次へ] をクリックします。
- シンクサービスとして [Cloud Pub/Sub トピック] を選択します。
- 作成したトピックを選択し、[次へ] をクリックします。
[包含フィルタの作成] に次のコードを入力します。
logName="projects/YOUR-PROJECT-ID/logs/analyticsdata.googleapis.com%2Ffresh_bigquery_export_status"
YOUR-PROJECT-ID は、Google Cloud コンソール プロジェクトの ID に置き換えます。
[次へ]、[シンクを作成] の順にクリックします。ログをフィルタする必要はありません。
シンクが [ログルーター シンク] の下に表示されていることを確認します。
不足しているデータを結合する
Cloud Run 関数を使用して、Pub/Sub が完全性シグナルを検出したときに、トラフィック ソースデータをバックフィルするコードを自動的に実行します。
- Cloud Run 関数を開きます。

- [CREATE FUNCTION] をクリックします。

- [環境] で [Cloud Run 関数] を選択します。
- 関数の名前を入力します。
- [トリガーのタイプ] として [Cloud Pub/Sub] を選択し、[Cloud Pub/Sub トピック] として作成したトピックを選択します。
- [次へ] をクリックし、Google 広告のアトリビューション データと BigQuery エクスポートを結合するコードを入力します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-19 UTC。
[null,null,["最終更新日 2024-12-19 UTC。"],[],["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."]]