Skip to content

Action Breakdowns Default Cause Incorrect Action Counts in Facebook Ads Source #642

@pjatx

Description

@pjatx

dlt version

dlt 1.12.0

Source name

facebook_ads

Describe the problem

When using the provided facebook_insights source and sample code, by default dlt passes through an array of pre-defined action_breakdowns through to the API call via the ALL_ACTION_BREAKDOWNS variable which is set here:

ALL_ACTION_BREAKDOWNS = ("action_type", "action_target_id", "action_destination")

And used as a default here:

action_breakdowns: Sequence[str] = ALL_ACTION_BREAKDOWNS,

This is problematic because Facebook will return completely different / incorrect action values back that don't align with what you would actually see if looking at Facebook's dashboard.

When passing through an empty array for action_breakdowns or omitting it entirely, it behaves as expected.

This was very non-intuitive and ate up a lot of time as I was trying to figure out what could be causing those discrepancies. I think the defaults should work esp given the examples provided vs returning incorrect data. More advanced users can add action_breakdowns if they know what they are doing.

Slack Discussion: https://dlthub-community.slack.com/archives/C04DQA7JJN6/p1754597588552409

Expected behavior

The number of actions I see in the dashboard when looking at an ad should match the 7_day_click values returned by the API and the DLT pipeline.

Actual:
The numbers vary significantly

Steps to reproduce

Steps to Reproduce:

  1. Setup a new DLT project and init the facebook_ads source
  2. Find an ad account with some actions data and set it up to work with DLT / add the credentials and values in secrets and config.
  3. Run the insights pipeline

How you are using the source?

I run this source in production.

Operating system

Linux

Runtime environment

Other

Python version

3.12

dlt destination

motherduck

Additional information

Proposed Solutions:

  1. Make the default for action_breakdowns [] or omit entirely unless added as a parameter
  2. Add a warning if enabled so the user knows it could impact the number of action counts received.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

Status

Implementation & Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions