Marketing Attribution Metrics dbt Package (Docs)
This package provides cross-functional metrics by combining Hubspot data from Fivetran's Hubspot connector and Segment data from Fivetran's Segment connector. It uses data in the format described by Hubspot ERD and Segment ERD.
This package enables you to attribute marketing campaigns to product events. The scope of this package is not just limited to product events, it can be transactions/subscriptions on Stripe and other activities tracked by SaaS tools.
This package contains transformed models built on top of Houseware's Hubspot package and Houseware's Segment package. Dependencies on these packages have been 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
metric | description |
---|---|
weekly_email_to_product_events | Weekly Email to Product Events. |
|
To use this dbt package, you must have the following:
- At least one Fivetran hubspot connector and one Fivetran segment 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/marketing_attribution_metrics.git"
revision: v0.1.0
By default, this package will look for your Hubspot data in the fivetran_hubspot
schema and Segment data in the fivetran_segment
schema of your target database. If this is not where your data is, please add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
config-version: 2
vars:
hubspot_source:
hubspot_schema: my_new_schema_name
segment_metrics:
segment__schema: my_new_schema_name
For additional configurations for the Hubspot source models, please visit the Hubspot source package.
By default this package will build the Hubspot staging models within a schema titled (<target_schema> + _stg_hubspot
) and the Hubspot metrics as well as Segment metrics within <target_schema> in your target database. If this is not where you would like your modeled Hubspot data to be written to, add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
models:
hubspot_metrics:
+schema: my_new_schema_name # leave blank for just the target_schema
hubspot_source:
+schema: my_new_schema_name # leave blank for just the target_schema
segment_metrics:
+schema: my_new_schema_name # leave blank for just the target_schema
vars:
marketing_attribution_metrics:
hubspot_email_event_filter__in: "('OPEN', 'CLICK')" # add more hubspot events here, if needed
hubspot_event_to_segment_event_time_interval: hour # change this to any `datediff` interval (hour, day, year, etc)
hubspot_event_to_segment_event_time_value: 2 # interval value between segment events and hubspot events
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