Write and run queries

Create a query

  1. Navigate to the Queries tab in Ads Data Hub.
  2. Click + Create query.
  3. Select Choose template or Create blank query.
    1. Choose template:
      1. Pick an applicable template.
        Preview a template's SQL by clicking the down arrow next to it.
    2. Create blank query:
      1. Write BigQuery compatible SQL.
  4. Give your query a name.
  5. Optionally, add parameters to your query.
  6. Optionally, add a filtered row summary to your query.
  7. Click Save.

Filtered row summary

Filtered row summaries tally data that was filtered due to privacy checks. Data from filtered rows is summed and added to a catch-all row. While the filtered data can't be further analyzed, it provides a summary of how much data was filtered from the results.

Edit a query

  1. Navigate to the Queries tab in Ads Data Hub.
  2. Click the name of the query you want to edit.
  3. Edit the query.
  4. Click Save.

Run a query

Before running a query, ensure that you've given the service account dataEditor permission to the dataset that will contain the output of your joins. Learn more about access control in Big Query.

  1. Navigate to the Queries tab in Ads Data Hub.
  2. Click the name of the query you want to run.
  3. Click Run () in the upper left corner of the editor.
  4. Select a customer in the Ads data from dropdown. (If you would like to query sandbox data, select ADH Sandbox Customer.)
  5. If using a match table, select the match table in the Match table from dropdown.
  6. Specify where your query results should be saved in the Destination table field.
  7. Enter start and end dates to determine the date range of your query.
  8. Click Run.

View your results

After your query finishes running you can view the results and explore the data in BigQuery, Google Sheets, or Data Studio.

BigQuery

Your results are exported to BigQuery by default. Click View table to open BigQuery in a new window.

Google Sheets and Data Studio

Open the Explore dropdown menu and select Explore with Google Sheets or Explore with Data Studio from the options. This opens the data in a new window.