Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add conversions #36

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

fivetran-jamie
Copy link
Contributor

@fivetran-jamie fivetran-jamie commented May 21, 2024

PR Overview

This PR will address the following Issue/Feature:
No issue created

This PR will result in the following new package version:

v0.8.0 -- looking at our UI, basic_ad_actions is a child of basic_ad and is included by default with it, but juuuust in case someone doesn't have the new table, let's make it breaking, as it is a schema change.

Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:

🚨 Breaking Changes 🚨

  • Incorporates the basic_ad_actions pre-built report in order to grab conversion data. basic_ad_actions is a child table of the already-required basic_ad report, broken down by action_type.
    • Addition of the new stg_facebook_ads__basic_ad_actions (and its _tmp counterpart) staging model. Given that this is a schema change for the package, this a breaking change.

Feature Updates

  • With the inclusion of the basic_ad_actions source table, creates a facebook_ads__basic_ad_actions_passthrough_metrics variable to pass through additional conversion value metrics to downstream models. By default, the package includes only the conversion value calculated using the default attribution window, but your report may include calculations using the other windows defined here. See README for details on how to use the new var.
  • Adds optimization_goal field to stg_facebook_ads__ad_set_history model. This is defined as the optimization goal this ad set is using, possible values of which are defined here.
  • Adds conversion_domain field to stg_facebook_ads__ad_history model. This is defined as the domain you've configured the ad to convert to.

Documentation

  • Documents the ability to transform metrics provided to the facebook_ads__basic_ad_passthrough_metrics variable. See README for details.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt run –full-refresh && dbt test
  • dbt run (if incremental models are present)

Before marking this PR as "ready for review" the following have been applied:

  • The appropriate issue has been linked, tagged, and properly assigned
  • All necessary documentation and version upgrades have been applied
  • docs were regenerated (unless this PR does not include any code or yml updates) -- post-approval
  • BuildKite integration tests are passing
  • Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

See Validation tests in transform PR

@fivetran-jamie fivetran-jamie self-assigned this May 21, 2024
@fivetran-jamie fivetran-jamie marked this pull request as ready for review May 21, 2024 23:11
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-jamie these changes look great! I just have a few minor suggestions, but none related to the actual code. I see this being a huge value add for our users!

Once you address the comments in this review let's hold off merging until the other updates in the Google and LinkedIn packages are ready as well. Thanks and great job!

Comment on lines +32 to +43
{#
Adapted from fivetran_utils.fill_pass_through_columns() macro.
Ensures that downstream summations work if a connector schema is missing one of your facebook_ads__basic_ad_actions_passthrough_metrics
#}
{% if var('facebook_ads__basic_ad_actions_passthrough_metrics') %}
{% for field in var('facebook_ads__basic_ad_actions_passthrough_metrics') %}
{% if field.transform_sql %}
, coalesce(cast({{ field.transform_sql }} as {{ dbt.type_float() }}), 0) as {{ field.alias if field.alias else field.name }}
{% else %}
, coalesce(cast({{ field.alias if field.alias else field.name }} as {{ dbt.type_float() }}), 0) as {{ field.alias if field.alias else field.name }}
{% endif %}
{% endfor %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider making this a macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

going back and forth on this one, as the code is more complex than what's usually in our staging models, but it is really only used in this one model, so creating a macro wouldn't make us any DRYer. what are your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. If it won't make things much dryer then there is no point in wrapping it up in a macro. I am good leaving as is. Thanks!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@fivetran-data-model-bot fivetran-data-model-bot requested review from a team, fivetran-reneeli and fivetran-avinash and removed request for a team May 23, 2024 18:44
fivetran-jamie and others added 4 commits May 23, 2024 13:20
Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
@SwapfietsDataDaan
Copy link

We just ran into an issue where we wanted to create a solution for exactly this. This will be super helpful.

@fivetran-jamie fivetran-jamie added the status:blocked Need additional information or requirements before proceeding label Sep 11, 2024
@fivetran-jamie
Copy link
Contributor Author

FYI for anyone subscribed here, this is currently blocked.

We are working with Engineering to ensure that the conversion monetary values (action_values) are included in a default report and therefore accessible to the package (currently, only the raw # of conversions are supported by the basic_ad_actions report).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:blocked Need additional information or requirements before proceeding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants