Google Ads Metrics dbt Package (Docs)
These packages are under active development and are expected to change with dbt metrics as it evolves over time. As of now, dbt metrics requires users to define models to calculate metrics and these models are persisted on the warehouse. Keeping this in mind, we have currently modelled our packages such that metrics and the models calculating these metrics have a 1:1 mapping, which is why you will see multiple metrics for the same conceptual metric entity accounting for different time grains and dimensions. In future, with the roll out of dbt Server and evolution of dbt metrics, we expect to streamline our packages to remove these redundancies.
The metrics in these packages are transformed on top of source data ETL'd via Fivetran to your warehouse. Make sure you have connected your SaaS source with Fivetran for the packages to work properly.
This package provides pre-built metrics for Google ads data from Fivetran's connector. It uses data in the format described by this ERD.
This package enables you to access commonly used metrics on top of Google Ads Data
This package contains transformed models built on top of google_ads_source package. A dependency on the source packages is declared in this package's packages.yml
file, so it will automatically download when you run dbt deps
.
The metrics offered by this package are described below. Note that some metrics contain extended metrics for segmentation based on adgroups, campaigns, and accounts.
metric | description |
---|---|
google_ads__monthly_ads | Number of ads running monthly |
google_ads__monthly_adgroups | Number of ad groups running monthly |
google_ads__monthly_campaigns | Number of campaigns running monthly |
google_ads__monthly_accounts | Number of accounts running monthly |
google_ads__monthly_impressions | Total monthly impressions received across all ads |
google_ads__monthly_ad_clicks | Total monthly clicks received across all ads |
google_ads__monthly_ad_conversions | Total monthly conversions received across all ads as measured by Google Ads |
google_ads__monthly_ad_conversion_value | Total monthly conversion value received across all ads as measured by Google Ads |
google_ads__monthly_ad_spend | Total monthly spend across all ads |
google_ads__monthly_cost_per_click | Monthly cost per ad click |
google_ads__monthly_cost_per_impression | Monthly cost per ad impression. |
google_ads__monthly_click_through_rate | Monthly rate of users clicking on ad after viewing. |
google_ads__monthly_cost_per_conversion | Monthly cost per ad conversion. |
google_ads__monthly_roas | Monthly return on ad spend. |
google_ads__monthly_avg_cost_per_click | Monthly average cost per ad click across all ads reported at a campaign level |
google_ads__monthly_avg_cost_per_impression | Monthly average cost per ad impression across all ads reported at a campaign level |
google_ads__monthly_avg_click_through_rate | Monthly average click-through rate across all ads reported at a campaign level |
google_ads__monthly_avg_cost_per_conversion | Monthly average cost per conversion across all ads reported at a campaign level |
google_ads__monthly_avg_roas | Monthly average return on ad spend across all ads reported at a campaign level |
Please refer to the following notes regarding nuances related to the data available from the package:
- The latest attributes for account, campaign, adgroup and ad (like
name
,status
) are being fetched from the Fivetran source tables. To change this, you can edit thedbt_project.yml
file:
# dbt_project.yml
...
config-version: 2
vars:
is_most_recent_record: 'FALSE'
- The calculation of monthly ratio metrics is done at an aggregate level. For example, the
Monthly Cost per Click
metric forcampaigns
is calculated asTotal Spend
(across all campaigns) /Total Clicks
(across all campaigns) - The calculation for average ratio metrics is done by taking the average of the ad-level ratio metrics at the campaign level. For example, the
Monthly Average Cost per Click
metric is calculated as Avg (Total Spend per Ad) / Avg (Total clicks per Ad) ; this number is reported per campaign
To use this dbt package, you must have the following:
- At least one Fivetran Google Ads connector syncing data into your destination.
- A BigQuery, Snowflake, Redshift, or PostgreSQL destination.
Check dbt Hub for the latest installation instructions, or read the dbt docs for more information on installing packages.
Include in your packages.yml
packages:
- git: "https://github.com/HousewareHQ/dbt_google_ads_metrics.git"
revision: v0.1.0
By default, this package will look for your Google Ads data in the fivetran_google_ads
schema of your target database. If this is not where your Google Ads data is, please add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
config-version: 2
vars:
google_ads_database: your_database_name
google_ads_schema: your_schema_name
For additional configurations for the source models, please visit the Google Ads source package.
By default this package will build the Google Ads staging models within a schema titled (<target_schema> + _stg_google_ads
) and the Google Ads metrics within the target schema with the suffix google_ads__
in your target database. If this is not where you would like your modeled Google Ads data to be written to, add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
models:
google_ads_metrics:
+schema: my_new_schema_name # leave blank for just the target_schema
google_ads_source:
+schema: my_new_schema_name # leave blank for just the target_schema
This package has been tested on Snowflake.
Additional contributions to this package are very welcome! Please create issues
or open PRs against main
. Check out
this post
on the best workflow for contributing to a package.
- Provide feedback on what you'd like to see next
- Have questions, feedback, or need help? Email us at [email protected]
- Check out Houseware's blog
- Learn more about dbt in the dbt docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the dbt blog for the latest news on dbt's development and best practices