Skip to content

feature/add_custom_action_conversions#61

Merged
fivetran-savage merged 9 commits intomainfrom
add_custom_action_conversions
Dec 22, 2025
Merged

feature/add_custom_action_conversions#61
fivetran-savage merged 9 commits intomainfrom
add_custom_action_conversions

Conversation

@fivetran-savage
Copy link
Copy Markdown
Contributor

PR Overview

Package version introduced in this PR:

  • 1.3.0

This PR addresses the following Issue/Feature(s):

Summary of changes:

  • Adds dynamic conversion columns based on facebook_ads__conversion_action_types to facebook_ads__account_report, facebook_ads__ad_report, facebook_ads__ad_set_report, facebook_ads__campaign_report, facebook_ads__country_report, facebook_ads__region_report, and int_facebook_ads__conversions
  • Adds facebook_action_slug macro to generate slugified column names from action type configurations.

Submission Checklist

  • Alignment meeting with the reviewer (if needed)
    • Timeline and validation requirements discussed
  • Provide validation details:
    • Validation Steps: Check for unintentional effects (e.g., add/run consistency & integrity tests)
    • Testing Instructions: Confirm the change addresses the issue(s)
    • Focus Areas: Complex logic or queries that need extra attention
  • Merge any relevant open PRs into this PR

Changelog

  • Draft changelog for PR
  • Final changelog for release review

@fivetran-savage fivetran-savage added the docs:ready Triggers the docs generator workflow. label Dec 18, 2025
Copy link
Copy Markdown
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

Looks great! Left some suggestions - biggest thing is we'll want to add conversions_value fields as well

CHANGELOG.md Outdated

| Data Model(s) | Change type | Old | New | Notes |
| ---------- | ----------- | -------- | -------- | ----- |
| [facebook_ads__account_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__account_report) | New Columns | | `onsite_conversion_purchase_conversions`, `onsite_conversion_lead_grouped_conversions`, `offsite_conversion_fb_pixel_purchase_conversions`, `offsite_conversion_fb_pixel_lead_conversions`, `offsite_conversion_fb_pixel_custom_conversions` | Adds individual conversion metrics for each default action type configured in the package. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the way you did Reddit Ads, where each field had its own row. The Data Models column can just read "All report models" or something like that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we do that, then I'd say the # of total changes should = the # of new fields per model

CHANGELOG.md Outdated
| [facebook_ads__region_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__region_report) | New Columns | | `onsite_conversion_purchase_conversions`, `onsite_conversion_lead_grouped_conversions`, `offsite_conversion_fb_pixel_purchase_conversions`, `offsite_conversion_fb_pixel_lead_conversions`, `offsite_conversion_fb_pixel_custom_conversions` | Adds individual conversion metrics for each default action type configured in the package. |
| [int_facebook_ads__conversions](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.int_facebook_ads__conversions) | New Columns | | `onsite_conversion_purchase_conversions`, `onsite_conversion_lead_grouped_conversions`, `offsite_conversion_fb_pixel_purchase_conversions`, `offsite_conversion_fb_pixel_lead_conversions`, `offsite_conversion_fb_pixel_custom_conversions` | Adds individual conversion metrics for each default action type configured in the package. |

The default action types included are `onsite_conversion.purchase`, `onsite_conversion.lead_grouped`, `offsite_conversion.fb_pixel_purchase`, `offsite_conversion.fb_pixel_lead`, and `offsite_conversion.fb_pixel_custom`. You can add additional custom action types by configuring the `facebook_ads__conversion_action_types` variable. See the README for details on how to configure custom action types.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
The default action types included are `onsite_conversion.purchase`, `onsite_conversion.lead_grouped`, `offsite_conversion.fb_pixel_purchase`, `offsite_conversion.fb_pixel_lead`, and `offsite_conversion.fb_pixel_custom`. You can add additional custom action types by configuring the `facebook_ads__conversion_action_types` variable. See the README for details on how to configure custom action types.
The default action types included are `onsite_conversion.purchase`, `onsite_conversion.lead_grouped`, `offsite_conversion.fb_pixel_purchase`, `offsite_conversion.fb_pixel_lead`, and `offsite_conversion.fb_pixel_custom`. You can add alternative conversion actions by configuring the `facebook_ads__conversion_action_types` variable. See the [README](https://github.com/fivetran/dbt_facebook_ads?tab=readme-ov-file#configuring-conversion-action-types) for details on how to configure custom action types.

@fivetran-savage fivetran-savage added docs:ready Triggers the docs generator workflow. and removed docs:ready Triggers the docs generator workflow. labels Dec 19, 2025
Copy link
Copy Markdown
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

Looks great - some suggestions about the changelog and just consolidating for loops! Will approve after those are adjusted

CHANGELOG.md Outdated
| Data Model(s) | Change type | Old | New | Notes |
| ---------- | ----------- | -------- | -------- | ----- |
| All facebook_ads__*_report models | New Columns | | `onsite_conversion_purchase_conversions`, `onsite_conversion_lead_grouped_conversions`, `offsite_conversion_fb_pixel_purchase_conversions`, `offsite_conversion_fb_pixel_lead_conversions`, `offsite_conversion_fb_pixel_custom_conversions` | Add individual conversion metrics for each default action type configured in the package. |
| All facebook_ads__*_report models except [facebook_ads__country_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__country_report) and [facebook_ads__region_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__region_report) | New Columns | | `onsite_conversion_purchase_conversions_value`, `onsite_conversion_lead_grouped_conversions_value`, `offsite_conversion_fb_pixel_purchase_conversions_value`, `offsite_conversion_fb_pixel_lead_conversions_value`, `offsite_conversion_fb_pixel_custom_conversions_value` | Add individual conversion metrics for each default action type configured in the package. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
| All facebook_ads__*_report models except [facebook_ads__country_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__country_report) and [facebook_ads__region_report](https://fivetran.github.io/dbt_facebook_ads/#!/model/model.facebook_ads.facebook_ads__region_report) | New Columns | | `onsite_conversion_purchase_conversions_value`, `onsite_conversion_lead_grouped_conversions_value`, `offsite_conversion_fb_pixel_purchase_conversions_value`, `offsite_conversion_fb_pixel_lead_conversions_value`, `offsite_conversion_fb_pixel_custom_conversions_value` | Add individual conversion metrics for each default action type configured in the package. |
| All non-geographical facebook_ads__*_report models | New Columns | | `onsite_conversion_purchase_conversions_value`, `onsite_conversion_lead_grouped_conversions_value`, `offsite_conversion_fb_pixel_purchase_conversions_value`, `offsite_conversion_fb_pixel_lead_conversions_value`, `offsite_conversion_fb_pixel_custom_conversions_value` | Add individual conversion metrics for each default action type configured in the package. |

Seems a little cleaner?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Awesome, thanks.

Comment on lines +43 to +51
{% for action_type in var('facebook_ads__conversion_action_types') %}
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions, 0))
as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions_value, 0))
as {{ facebook_action_slug(action_type) }}_conversions_value
{% endfor %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% for action_type in var('facebook_ads__conversion_action_types') %}
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions, 0))
as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}
{% for action_type in var('facebook_ads__conversion_action_types') %}
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions_value, 0))
as {{ facebook_action_slug(action_type) }}_conversions_value
{% endfor %}
{% for action_type in var('facebook_ads__conversion_action_types') %}
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions, 0))
as {{ facebook_action_slug(action_type) }}_conversions
, sum(coalesce(conversion_report.{{ facebook_action_slug(action_type) }}_conversions_value, 0))
as {{ facebook_action_slug(action_type) }}_conversions_value
{% endfor %}

Since these are the same for loop, could you consolidate?

as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same request to consolidate the for loops

as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same request to consolidate the for loops

as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same request to consolidate the for loops

as {{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same request to consolidate the for loops

,{{ facebook_action_slug(action_type) }}_conversions
{% endfor %}

{% for action_type in var('facebook_ads__conversion_action_types') %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same request to consolidate the for loops

Copy link
Copy Markdown
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

Looks great! Just 2 final suggestions in the changelog only and then we're good to go

CHANGELOG.md Outdated
Comment on lines +10 to +19
| All facebook_ads__*_report models | New Column | | `onsite_conversion_purchase_conversions` | Total attributed conversions for onsite_conversion_purchase action type. |
| All facebook_ads__*_report models | New Column | | `onsite_conversion_lead_grouped_conversions` | Total attributed conversions for onsite_conversion_lead_grouped action type. |
| All facebook_ads__*_report models | New Column | | `offsite_conversion_fb_pixel_purchase_conversions` | Total attributed conversions for offsite_conversion_fb_pixel_purchase action type. |
| All facebook_ads__*_report models | New Column | | `offsite_conversion_fb_pixel_lead_conversions` | Total attributed conversions for offsite_conversion_fb_pixel_lead action type. |
| All facebook_ads__*_report models | New Column | | `offsite_conversion_fb_pixel_custom_conversions` | Total attributed conversions for offsite_conversion_fb_pixel_custom action type. |
| All non-geographical facebook_ads__*_report models | New Column | | `onsite_conversion_purchase_conversions_value` | Total attributed conversions_value for onsite_conversion_purchase action type. |
| All non-geographical facebook_ads__*_report models | New Column | | `onsite_conversion_lead_grouped_conversions_value` | Total attributed conversions_value for onsite_conversion_lead_grouped action type. |
| All non-geographical facebook_ads__*_report models | New Column | | `offsite_conversion_fb_pixel_purchase_conversions_value` | Total attributed conversions_value for offsite_conversion_fb_pixel_purchase action type. |
| All non-geographical facebook_ads__*_report models | New Column | | `ooffsite_conversion_fb_pixel_lead_conversions_value` | Total attributed conversions_value for offsite_conversion_fb_pixel_lead action type. |
| All non-geographical facebook_ads__*_report models | New Column | | `offsite_conversion_fb_pixel_custom_conversions_value` | Total attributed conversions_value for offsite_conversion_fb_pixel_custom action type. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the field descriptions could you use the definitions you have in the facebook.yml? Those ones convey the actual events a bit more clearly

CHANGELOG.md Outdated
[PR #60](https://github.com/fivetran/dbt_facebook_ads/pull/60) includes the following updates:

## Schema/Data Change
**35 total changes • 0 possible breaking changes**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
**35 total changes • 0 possible breaking changes**
**10 total changes • 0 possible breaking changes**

This might make a little more sense since there are 10 rows/new fields

Copy link
Copy Markdown
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
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.

LGTM

@fivetran-savage fivetran-savage merged commit 0abaf45 into main Dec 22, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs:ready Triggers the docs generator workflow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants