PostHog / PostHog/posthog

Meta Ads source: add video_thruplay_watched_actions to AdStats schema

Open
#49,561 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Problem

The Meta Ads data warehouse connector's AdStats schema (posthog/temporal/data_imports/sources/meta_ads/schemas.py) does not request video_thruplay_watched_actions from the Meta Marketing API /insights endpoint.

This field is the standard metric for ThruPlays (15 seconds of viewing or video completion, whichever is shorter) — the primary optimization objective for video campaigns. Without it, users can only access actions.video_view which represents 3-second video views, a ~3–9× different metric.

The schema already includes the related percentile fields (video_p25_watched_actions through video_p100_watched_actions) and video_30_sec_watched_actions, so this appears to be an oversight rather than an intentional exclusion.

Proposed fix

Add "video_thruplay_watched_actions" to the field_names list for MetaAdsResource.AdStats (and ideally AdsetStats and CampaignStats as well):

"field_names": [
    # ... existing fields ...
    "video_30_sec_watched_actions",
    "video_thruplay_watched_actions",  # <-- add this
    "video_p25_watched_actions",
    # ...
]

Context

Impact

Any PostHog user running video ad campaigns on Meta optimizing for ThruPlays cannot get their primary KPI from the data warehouse. The only workaround is to pull the data separately via Meta's API and load it as a custom source.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in posthog/temporal/data_imports/sources/meta_ads/schemas.py and inspect the field_names list for MetaAdsResource.AdStats, then compare the related AdsetStats and CampaignStats schemas. Add video_thruplay_watched_actions where appropriate and verify that the Meta Ads insights request includes the field for the intended resources.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data-engineering
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.