:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse): expand ad source metric coverage (#118710)
Javier Bahamondesdc7f9bfd5c3b
diff --git a/docs/published/handbook/engineering/data-warehouse.md b/docs/published/handbook/engineering/data-warehouse.mdindex c20517db75ed..1e602676b729 100644--- a/docs/published/handbook/engineering/data-warehouse.md+++ b/docs/published/handbook/engineering/data-warehouse.md@@ -291,6 +291,29 @@ This changes setup recommendations and diagnostic actions, not report attributio3. Hit next, then select which tables you'd like to import. [More info on the sync types can be found here](https://posthog.com/docs/cdp/sources#incremental-vs-append-only-vs-full-table). For the Postgres-specific `xmin` (cursorless incremental) sync type and its limitations, see the [Postgres source README](https://github.com/PostHog/posthog/blob/master/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/README.md)4. Hit next and finish the import - `temporal-worker-data-warehouse` will then import the data into your local object storage+## Validating ad source metric imports++Meta Ads requests `video_play_actions` and `video_thruplay_watched_actions` on its campaign, ad set, ad, and supported breakdown statistics tables.+Hourly statistics and `ad_stats_by_link_url` exclude both fields because these breakdowns do not support them.+See [hourly restrictions](https://fivetran.com/docs/connectors/applications/facebook-ads/custom-reports#breakdowns) and [creative-asset metric restrictions](https://docs.streamkap.com/facebook-ads-source#custom-insights).+Custom conversion counts and values remain in the `actions` and `action_values` arrays returned by Meta.++Google Ads exposes daily Search and Display impression share through the optional `campaign_impression_share_stats` table.+This table omits the click-type segmentation used by `campaign_stats` because impression share does not support that combination.+The `campaign.labels` resource names in campaign metadata can be matched to `label.resource_name` in label metadata.++TikTok Ads requests `total_landing_page_view`, `engaged_view_15s`, `cta_conversion`, and `cta_purchase` in its campaign, ad group, and ad BASIC reports.+The CTA fields describe app conversions and purchases attributed to clicks; they do not establish a click-only website purchase metric.+The optional `advertiser_report` table requests daily `spend` and `cash_spend` at advertiser level.+Cash spend can arrive later than other performance metrics.++Reddit Ads requests purchase click and view counts, sign-up click counts, average purchase value, fully viewable video impressions, and viewable video impressions in its campaign, ad group, ad, and breakdown reports.+The conversion window still follows the account's attribution settings.++When validating these changes locally, enable the optional tables and inspect the requested fields in a completed sync.+Existing historical rows do not acquire newly requested fields until their date range is synced again.+Unit tests cover request construction and response handling; a live sync is needed to check that the provider accepts each metric combination and returns data for the connected account.+## Accessing object storageAll your data warehouse data is stored in your local object storage (SeaweedFS, S3-compatible, running at `http://localhost:19000`). Unlike MinIO, SeaweedFS has no web console, so inspect it with any S3 client. For example, with the AWS CLI:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.pyindex 0402c4e87bb6..601c0cb70e4e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py@@ -147,6 +147,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {**_IDS,"campaign_name": "Name of the campaign.","campaign_status": "Status of the campaign (enabled, paused, or removed).",+ "campaign_labels": "Resource names of labels attached to the campaign.","campaign_serving_status": "Whether the campaign is currently able to serve ads.","campaign_advertising_channel_type": "Primary serving target (e.g. search, display, shopping, video).","campaign_advertising_channel_sub_type": "More specific serving target within the channel type.",@@ -176,6 +177,20 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {metrics_video_view_rate="Video views divided by video ad impressions.",),},+ "campaign_impression_share_stats": {+ "description": "Daily campaign impression share for Search and Display, without click-type segmentation.",+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/campaign",+ "columns": {+ "customer_id": "The Google Ads customer (account) ID.",+ "campaign_id": "The campaign ID the metrics belong to.",+ "campaign_name": "Name of the campaign.",+ "campaign_advertising_channel_type": "Primary serving target of the campaign.",+ "segments_date": "The date the metrics are reported for.",+ "metrics_impressions": "Number of impressions.",+ "metrics_search_impression_share": "Share of eligible Search Network impressions received. Values below 0.1 are reported as 0.0999.",+ "metrics_content_impression_share": "Share of eligible Display Network impressions received. Values below 0.1 are reported as 0.0999.",+ },+ },"keyword": {"description": "A keyword criterion (keyword_view) — a search term that triggers an ad, with its bid and quality.","docs_url": "https://developers.google.com/google-ads/api/fields/v17/keyword_view",@@ -491,6 +506,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"customer_id": "The Google Ads customer (account) ID the label belongs to.","label_id": "Unique ID of the label.","label_name": "Name of the label.",+ "label_resource_name": "Resource name of the label, as referenced by campaign_labels.","label_status": "Status of the label (enabled or removed).","label_text_label_background_color": "Background color of the label, in hex format.","label_text_label_description": "Short description of the label.",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.pyindex fddc0411b8b6..7e8f78783d22 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py@@ -400,6 +400,7 @@ RESOURCE_SCHEMAS: dict[str, dict[str, Any]] = {"campaign.maximize_conversion_value.target_roas","campaign.name","campaign.percent_cpc.enhanced_cpc_enabled",+ "campaign.labels","campaign.serving_status","campaign.start_date_time","campaign.status",@@ -525,6 +526,23 @@ RESOURCE_SCHEMAS: dict[str, dict[str, Any]] = {"segments.year",],},+ "campaign_impression_share_stats": {+ "resource_name": "campaign",+ "primary_key": ["campaign.id", "customer.id", "segments.date"],+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],+ "should_sync_default": False,+ "description": "Daily campaign impression share for Search and Display, without click-type segmentation.",+ "field_names": [+ "campaign.id",+ "campaign.name",+ "campaign.advertising_channel_type",+ "customer.id",+ "segments.date",+ "metrics.impressions",+ "metrics.search_impression_share",+ "metrics.content_impression_share",+ ],+ },"keyword": {"resource_name": "keyword_view","removed_filter": "ad_group_criterion.status != 'REMOVED' AND ad_group.status != 'REMOVED' AND campaign.status != 'REMOVED'",@@ -1069,6 +1087,7 @@ RESOURCE_SCHEMAS: dict[str, dict[str, Any]] = {"label.id","customer.id","label.name",+ "label.resource_name","label.status","label.text_label.background_color","label.text_label.description",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/canonical_descriptions.pyindex 5f4229efacec..fc3cf97d8a95 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/canonical_descriptions.py@@ -37,6 +37,8 @@ _COMMON_STATS_COLUMNS = {"conversion_values": "The total value of conversions attributed to the ads.","cost_per_action_type": "Average cost per action, broken down by action type.","action_values": "The total value of actions, broken down by action type.",+ "video_play_actions": "Number of times the video started playing, reported by action type.",+ "video_thruplay_watched_actions": "Number of video plays lasting at least 15 seconds, or to completion for shorter videos, reported by action type.",}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/schemas.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/schemas.pyindex 80c97e6f1b08..20eb37f46b44 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/schemas.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/schemas.py@@ -133,6 +133,8 @@ _BREAKDOWN_METRIC_FIELDS = ["action_values","purchase_roas","website_purchase_roas",+ "video_play_actions",+ "video_thruplay_watched_actions",# The attribution window Meta actually applied to these rows, so imported numbers can be# reconciled against Ads Manager (see the source's attribution-window config)."attribution_setting",@@ -158,12 +160,20 @@ _UNIQUE_METRIC_FIELDS = {}-def _without_unique_metrics(field_names: list[str]) -> list[str]:- return [f for f in field_names if f not in _UNIQUE_METRIC_FIELDS]+# Hourly and creative-asset breakdowns do not support these video metrics.+_VIDEO_METRIC_FIELDS = {"video_play_actions", "video_thruplay_watched_actions"}-HOURLY_BREAKDOWN_STATS_FIELDS = _without_unique_metrics(CAMPAIGN_BREAKDOWN_STATS_FIELDS)-AD_ASSET_BREAKDOWN_STATS_FIELDS = _without_unique_metrics(AD_BREAKDOWN_STATS_FIELDS)+def _without_metrics(field_names: list[str], excluded_fields: set[str]) -> list[str]:+ return [f for f in field_names if f not in excluded_fields]+++HOURLY_BREAKDOWN_STATS_FIELDS = _without_metrics(+ CAMPAIGN_BREAKDOWN_STATS_FIELDS, _UNIQUE_METRIC_FIELDS | _VIDEO_METRIC_FIELDS+)+AD_ASSET_BREAKDOWN_STATS_FIELDS = _without_metrics(+ AD_BREAKDOWN_STATS_FIELDS, _UNIQUE_METRIC_FIELDS | _VIDEO_METRIC_FIELDS+)@frozen@@ -294,6 +304,8 @@ RESOURCE_SCHEMAS: dict[MetaAdsResource, dict[str, Any]] = {"website_purchase_roas","attribution_setting","video_30_sec_watched_actions",+ "video_play_actions",+ "video_thruplay_watched_actions","video_p25_watched_actions","video_p50_watched_actions","video_p75_watched_actions",@@ -371,6 +383,8 @@ RESOURCE_SCHEMAS: dict[MetaAdsResource, dict[str, Any]] = {"purchase_roas","website_purchase_roas","attribution_setting",+ "video_play_actions",+ "video_thruplay_watched_actions",],"partition_mode": "datetime","partition_format": "week",@@ -439,6 +453,8 @@ RESOURCE_SCHEMAS: dict[MetaAdsResource, dict[str, Any]] = {"purchase_roas","website_purchase_roas","attribution_setting",+ "video_play_actions",+ "video_thruplay_watched_actions",],"partition_mode": "datetime","partition_format": "week",@@ -624,7 +640,7 @@ RESOURCE_SCHEMAS: dict[MetaAdsResource, dict[str, Any]] = {MetaAdsResource.AdsetStatsHourly: _breakdown_stats("adset",["hourly_stats_aggregated_by_advertiser_time_zone"],- _without_unique_metrics(ADSET_BREAKDOWN_STATS_FIELDS),+ _without_metrics(ADSET_BREAKDOWN_STATS_FIELDS, _UNIQUE_METRIC_FIELDS | _VIDEO_METRIC_FIELDS),),MetaAdsResource.AdStatsByAgeGender: _breakdown_stats("ad", ["age", "gender"], AD_BREAKDOWN_STATS_FIELDS),MetaAdsResource.AdStatsByCountry: _breakdown_stats("ad", ["country"], AD_BREAKDOWN_STATS_FIELDS),@@ -633,7 +649,9 @@ RESOURCE_SCHEMAS: dict[MetaAdsResource, dict[str, Any]] = {"ad", ["publisher_platform", "platform_position", "impression_device"], AD_BREAKDOWN_STATS_FIELDS),MetaAdsResource.AdStatsHourly: _breakdown_stats(- "ad", ["hourly_stats_aggregated_by_advertiser_time_zone"], _without_unique_metrics(AD_BREAKDOWN_STATS_FIELDS)+ "ad",+ ["hourly_stats_aggregated_by_advertiser_time_zone"],+ _without_metrics(AD_BREAKDOWN_STATS_FIELDS, _UNIQUE_METRIC_FIELDS | _VIDEO_METRIC_FIELDS),),# Spend against the landing page an ad sent people to. Meta reports the destination URL only# as a creative asset, and `ad_creatives.link_url` alone cannot carry spend, so this is thediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.pyindex 205a3b7252a2..5bdd0a036bc3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py@@ -2342,6 +2342,18 @@ class TestBreakdownStatsRequests:assert result.requests[0].param("breakdowns") == schema.extra_params["breakdowns"]assert result.requests[0].param("level") == schema.extra_params["level"]+ fields_param = result.requests[0].param("fields")+ assert fields_param is not None+ requested_fields = set(fields_param.split(","))+ video_fields = {"video_play_actions", "video_thruplay_watched_actions"}+ if (+ "hourly_stats_aggregated_by_advertiser_time_zone" in schema.extra_params["breakdowns"]+ or endpoint == MetaAdsResource.AdStatsByLinkUrl+ ):+ assert video_fields.isdisjoint(requested_fields)+ else:+ assert video_fields <= requested_fields+def test_non_stats_endpoint_is_not_windowed(self, monkeypatch) -> None:result = self._capture_request(monkeypatch, MetaAdsResource.AdCreatives)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/canonical_descriptions.pyindex ff376a8d25e3..d482617d2921 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/canonical_descriptions.py@@ -34,6 +34,10 @@ _REPORT_COLUMNS = {"conversion_roas": "Return on ad spend from conversions.","conversion_purchase_total_items": "Total number of items purchased from conversions.","conversion_purchase_total_value": "Total value of purchase conversions.",+ "conversion_purchase_avg_value": "Average value of a purchase conversion.",+ "conversion_purchase_clicks": "Number of purchase conversions attributed to clicks.",+ "conversion_purchase_views": "Number of purchase conversions attributed to views.",+ "conversion_sign_up_clicks": "Number of sign-up conversions attributed to clicks.","conversion_purchase_total_value_all": "Total value of purchase conversions across all attribution windows (click and view-through).","conversion_sign_up_views": "Number of sign-up view conversions.","conversion_signup_total_value": "Total value of sign-up conversions.",@@ -44,6 +48,8 @@ _REPORT_COLUMNS = {"key_conversion_rate": "Rate of the key conversion event.","key_conversion_total_count": "Total count of the key conversion event.","video_started": "Number of video views started.",+ "video_fully_viewable_impressions": "Number of fully viewable video impressions.",+ "video_viewable_impressions": "Number of viewable video impressions.","video_view_rate": "Rate at which the video was viewed.","video_completion_rate": "Rate at which the video was watched to completion.","video_watched_25_percent": "Number of times the video was watched to 25%.",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/settings.pyindex 5725c404ea8b..799233249ce7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/reddit_ads/settings.py@@ -60,9 +60,13 @@ def _entity_endpoint(# objective-specific, so neither survives a per-dimension breakdown usefully._BREAKDOWN_REPORT_METRICS = ["CLICKS",+ "CONVERSION_PURCHASE_AVG_VALUE",+ "CONVERSION_PURCHASE_CLICKS","CONVERSION_PURCHASE_TOTAL_ITEMS","CONVERSION_PURCHASE_TOTAL_VALUE",+ "CONVERSION_PURCHASE_VIEWS","CONVERSION_ROAS",+ "CONVERSION_SIGN_UP_CLICKS","CPC","CTR","CURRENCY",@@ -72,7 +76,9 @@ _BREAKDOWN_REPORT_METRICS = ["KEY_CONVERSION_TOTAL_COUNT","SPEND","VIDEO_COMPLETION_RATE",+ "VIDEO_FULLY_VIEWABLE_IMPRESSIONS","VIDEO_STARTED",+ "VIDEO_VIEWABLE_IMPRESSIONS","VIDEO_VIEW_RATE","VIDEO_WATCHED_100_PERCENT","VIDEO_WATCHED_25_PERCENT",@@ -248,9 +254,13 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"APP_INSTALL_ROAS_DOUBLE","CAMPAIGN_ID","CLICKS",+ "CONVERSION_PURCHASE_AVG_VALUE",+ "CONVERSION_PURCHASE_CLICKS","CONVERSION_PURCHASE_TOTAL_ITEMS","CONVERSION_PURCHASE_TOTAL_VALUE",+ "CONVERSION_PURCHASE_VIEWS","CONVERSION_ROAS",+ "CONVERSION_SIGN_UP_CLICKS","CONVERSION_SIGN_UP_VIEWS","CONVERSION_SIGNUP_TOTAL_VALUE","CPC",@@ -265,7 +275,9 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"REACH","SPEND","VIDEO_COMPLETION_RATE",+ "VIDEO_FULLY_VIEWABLE_IMPRESSIONS","VIDEO_STARTED",+ "VIDEO_VIEWABLE_IMPRESSIONS","VIDEO_VIEW_RATE","VIDEO_WATCHED_100_PERCENT","VIDEO_WATCHED_25_PERCENT",@@ -318,9 +330,13 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"APP_INSTALL_REVENUE","APP_INSTALL_ROAS_DOUBLE","CLICKS",+ "CONVERSION_PURCHASE_AVG_VALUE",+ "CONVERSION_PURCHASE_CLICKS","CONVERSION_PURCHASE_TOTAL_ITEMS","CONVERSION_PURCHASE_TOTAL_VALUE",+ "CONVERSION_PURCHASE_VIEWS","CONVERSION_ROAS",+ "CONVERSION_SIGN_UP_CLICKS","CONVERSION_SIGN_UP_VIEWS","CONVERSION_SIGNUP_TOTAL_VALUE","CPC",@@ -334,7 +350,9 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"REACH","SPEND","VIDEO_COMPLETION_RATE",+ "VIDEO_FULLY_VIEWABLE_IMPRESSIONS","VIDEO_STARTED",+ "VIDEO_VIEWABLE_IMPRESSIONS","VIDEO_VIEW_RATE","VIDEO_WATCHED_100_PERCENT","VIDEO_WATCHED_25_PERCENT",@@ -387,9 +405,13 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"APP_INSTALL_REVENUE","APP_INSTALL_ROAS_DOUBLE","CLICKS",+ "CONVERSION_PURCHASE_AVG_VALUE",+ "CONVERSION_PURCHASE_CLICKS","CONVERSION_PURCHASE_TOTAL_ITEMS","CONVERSION_PURCHASE_TOTAL_VALUE",+ "CONVERSION_PURCHASE_VIEWS","CONVERSION_ROAS",+ "CONVERSION_SIGN_UP_CLICKS","CONVERSION_SIGN_UP_VIEWS","CONVERSION_SIGNUP_TOTAL_VALUE","CPC",@@ -404,7 +426,9 @@ REDDIT_ADS_CONFIG: dict[str, EndpointConfig] = {"REACH","SPEND","VIDEO_COMPLETION_RATE",+ "VIDEO_FULLY_VIEWABLE_IMPRESSIONS","VIDEO_STARTED",+ "VIDEO_VIEWABLE_IMPRESSIONS","VIDEO_VIEW_RATE","VIDEO_WATCHED_100_PERCENT","VIDEO_WATCHED_25_PERCENT",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/canonical_descriptions.pyindex d742c4e8bd14..39489e88810f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/canonical_descriptions.py@@ -25,6 +25,10 @@ _REPORT_METRIC_COLUMNS = {"reach": "Number of unique users who saw the ads.","frequency": "Average number of times each user saw the ads.","currency": "Currency the monetary metrics are reported in.",+ "engaged_view_15s": "Number of 15-second focused video views, including qualifying engagements.",+ "total_landing_page_view": "Number of landing page view events attributed to the ads.",+ "cta_conversion": "Number of app install conversions attributed to clicks.",+ "cta_purchase": "Number of in-app purchases attributed to clicks.",}@@ -137,6 +141,16 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"modify_time": "Time at which the ad was last modified.",},},+ "advertiser_report": {+ "description": "Daily advertiser spend, including the amount charged to cash rather than vouchers.",+ "docs_url": "https://business-api.tiktok.com/portal/docs/data-latency-for-reports/v1.3",+ "columns": {+ "advertiser_id": "ID of the advertiser account the metrics belong to.",+ "stat_time_day": "Date the metrics are aggregated for.",+ "spend": "Total amount spent in the reporting period.",+ "cash_spend": "Amount spent that was charged to cash rather than vouchers. Available at advertiser and day granularity; reporting can be delayed.",+ },+ },"campaign_report": {"description": "Daily performance metrics for each campaign.","docs_url": "https://business-api.tiktok.com/portal/docs?id=1740302848100353",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/settings.pyindex 5efccd661ad3..8fb51562c5cb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tiktok_ads/settings.py@@ -28,6 +28,8 @@ METRICS_FIELDS = ["conversion_rate_v2","conversion_rate","conversion",+ "cta_conversion",+ "cta_purchase","complete_payment","total_complete_payment_rate","cost_per_1000_reached",@@ -38,6 +40,7 @@ METRICS_FIELDS = ["cpm","ctr","currency",+ "engaged_view_15s","follows","frequency","gross_impressions",@@ -60,6 +63,7 @@ METRICS_FIELDS = ["shares","spend","split_test",+ "total_landing_page_view","video_play_actions","video_views_p100","video_views_p25",@@ -218,6 +222,41 @@ def audience_report_config(name: str, data_level: str, dimensions: list[str], meTIKTOK_ADS_CONFIG: dict[str, EndpointConfig] = {+ "advertiser_report": EndpointConfig(+ resource={+ "name": "advertiser_report",+ "table_name": "advertiser_report",+ "primary_key": ["advertiser_id", "stat_time_day"],+ "endpoint": {+ "path": "/report/integrated/get/",+ "method": "GET",+ "params": {+ "advertiser_id": "{advertiser_id}",+ "service_type": "AUCTION",+ "report_type": "BASIC",+ "data_level": "AUCTION_ADVERTISER",+ "dimensions": '["advertiser_id", "stat_time_day"]',+ "metrics": json.dumps(["spend", "cash_spend"]),+ "page_size": 1000,+ "start_date": "{start_date}",+ "end_date": "{end_date}",+ },+ "data_selector": "data.list",+ "incremental": {+ "cursor_path": "stat_time_day",+ "start_param": "start_date",+ "end_param": "end_date",+ },+ },+ "table_format": "delta",+ },+ incremental_fields=[STAT_TIME_DAY_INCREMENTAL_FIELD],+ partition_keys=["stat_time_day"],+ partition_mode="datetime",+ partition_format="week",+ endpoint_type=EndpointType.REPORT,+ should_sync_default=False,+ ),"campaigns": EndpointConfig(resource={# Docs: https://business-api.tiktok.com/portal/docs?id=1739315828649986