late-sdk 0.0.613 → 0.0.615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/docs/AdCampaignsApi.md +6 -0
- data/docs/AdCreative.md +2 -0
- data/docs/AnalyticsApi.md +78 -2
- data/docs/FacebookPostEarningsResponse.md +32 -0
- data/docs/FacebookPostEarningsResponseMetricsValue.md +22 -0
- data/docs/FacebookPostEarningsResponseUnavailableMetricsInner.md +22 -0
- data/docs/InstagramAccountInsightsResponse.md +3 -1
- data/docs/InstagramAccountInsightsResponseMetricsValue.md +6 -2
- data/docs/InstagramAccountInsightsResponseUnavailableMetricsInner.md +22 -0
- data/lib/zernio-sdk/api/ad_campaigns_api.rb +9 -0
- data/lib/zernio-sdk/api/analytics_api.rb +76 -2
- data/lib/zernio-sdk/models/ad_creative.rb +12 -1
- data/lib/zernio-sdk/models/facebook_post_earnings_response.rb +253 -0
- data/lib/zernio-sdk/models/facebook_post_earnings_response_metrics_value.rb +203 -0
- data/lib/zernio-sdk/models/facebook_post_earnings_response_unavailable_metrics_inner.rb +202 -0
- data/lib/zernio-sdk/models/instagram_account_insights_response.rb +14 -2
- data/lib/zernio-sdk/models/instagram_account_insights_response_metrics_value.rb +60 -5
- data/lib/zernio-sdk/models/instagram_account_insights_response_unavailable_metrics_inner.rb +202 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +4 -0
- data/openapi.yaml +326 -2
- data/spec/api/ad_campaigns_api_spec.rb +3 -0
- data/spec/api/analytics_api_spec.rb +15 -1
- data/spec/models/ad_creative_spec.rb +6 -0
- data/spec/models/facebook_post_earnings_response_metrics_value_spec.rb +52 -0
- data/spec/models/facebook_post_earnings_response_spec.rb +82 -0
- data/spec/models/facebook_post_earnings_response_unavailable_metrics_inner_spec.rb +52 -0
- data/spec/models/instagram_account_insights_response_metrics_value_spec.rb +16 -0
- data/spec/models/instagram_account_insights_response_spec.rb +6 -0
- data/spec/models/instagram_account_insights_response_unavailable_metrics_inner_spec.rb +52 -0
- data/zernio-sdk-0.0.615.gem +0 -0
- metadata +18 -2
- data/zernio-sdk-0.0.613.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c34aacb7001c9dc8d3419bfdb30fd2f0cce5e9928b45884572d5e4e1f69b0a8
|
|
4
|
+
data.tar.gz: 107b48d949543db735a3c63a36ecacd1ffded8318d94a7979b68e3f63912115a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e805df737a3802362d9553ff95439b0f5819fd4b4b94f7a95311d787917f131b6687116dc72f57c58b0206b328222a4f7593eb0230e8e72dd85a79a61558396
|
|
7
|
+
data.tar.gz: d051033d468cc1ea6d0ac25d8933438bec3d89ddfd7204c9a99b491f5b702c1615c00c38be2c8a4f7a2259d8d1c65ceaaedfac39ac3e724418601407c87e1d83
|
data/README.md
CHANGED
|
@@ -160,6 +160,7 @@ Class | Method | HTTP request | Description
|
|
|
160
160
|
*Zernio::AnalyticsApi* | [**get_content_decay**](docs/AnalyticsApi.md#get_content_decay) | **GET** /v1/analytics/content-decay | Get content performance decay
|
|
161
161
|
*Zernio::AnalyticsApi* | [**get_daily_metrics**](docs/AnalyticsApi.md#get_daily_metrics) | **GET** /v1/analytics/daily-metrics | Get daily aggregated metrics
|
|
162
162
|
*Zernio::AnalyticsApi* | [**get_facebook_page_insights**](docs/AnalyticsApi.md#get_facebook_page_insights) | **GET** /v1/analytics/facebook/page-insights | Get Facebook Page insights
|
|
163
|
+
*Zernio::AnalyticsApi* | [**get_facebook_post_earnings**](docs/AnalyticsApi.md#get_facebook_post_earnings) | **GET** /v1/analytics/facebook/post-earnings | Get Facebook post monetization earnings
|
|
163
164
|
*Zernio::AnalyticsApi* | [**get_facebook_post_reactions**](docs/AnalyticsApi.md#get_facebook_post_reactions) | **GET** /v1/accounts/{accountId}/facebook-post-reactions | Get Facebook post reactions
|
|
164
165
|
*Zernio::AnalyticsApi* | [**get_follower_stats**](docs/AnalyticsApi.md#get_follower_stats) | **GET** /v1/accounts/follower-stats | Get follower stats
|
|
165
166
|
*Zernio::AnalyticsApi* | [**get_google_business_performance**](docs/AnalyticsApi.md#get_google_business_performance) | **GET** /v1/analytics/googlebusiness/performance | Get GBP performance metrics
|
|
@@ -971,6 +972,9 @@ Class | Method | HTTP request | Description
|
|
|
971
972
|
- [Zernio::ExternalPostWebhookPost](docs/ExternalPostWebhookPost.md)
|
|
972
973
|
- [Zernio::FacebookPlatformData](docs/FacebookPlatformData.md)
|
|
973
974
|
- [Zernio::FacebookPlatformDataCarouselCardsInner](docs/FacebookPlatformDataCarouselCardsInner.md)
|
|
975
|
+
- [Zernio::FacebookPostEarningsResponse](docs/FacebookPostEarningsResponse.md)
|
|
976
|
+
- [Zernio::FacebookPostEarningsResponseMetricsValue](docs/FacebookPostEarningsResponseMetricsValue.md)
|
|
977
|
+
- [Zernio::FacebookPostEarningsResponseUnavailableMetricsInner](docs/FacebookPostEarningsResponseUnavailableMetricsInner.md)
|
|
974
978
|
- [Zernio::FetchGoogleBusinessVerificationOptions200Response](docs/FetchGoogleBusinessVerificationOptions200Response.md)
|
|
975
979
|
- [Zernio::FetchGoogleBusinessVerificationOptions200ResponseOptionsInner](docs/FetchGoogleBusinessVerificationOptions200ResponseOptionsInner.md)
|
|
976
980
|
- [Zernio::FetchGoogleBusinessVerificationOptionsRequest](docs/FetchGoogleBusinessVerificationOptionsRequest.md)
|
|
@@ -1340,6 +1344,7 @@ Class | Method | HTTP request | Description
|
|
|
1340
1344
|
- [Zernio::InstagramAccountInsightsResponseMetricsValue](docs/InstagramAccountInsightsResponseMetricsValue.md)
|
|
1341
1345
|
- [Zernio::InstagramAccountInsightsResponseMetricsValueBreakdownsInner](docs/InstagramAccountInsightsResponseMetricsValueBreakdownsInner.md)
|
|
1342
1346
|
- [Zernio::InstagramAccountInsightsResponseMetricsValueValuesInner](docs/InstagramAccountInsightsResponseMetricsValueValuesInner.md)
|
|
1347
|
+
- [Zernio::InstagramAccountInsightsResponseUnavailableMetricsInner](docs/InstagramAccountInsightsResponseUnavailableMetricsInner.md)
|
|
1343
1348
|
- [Zernio::InstagramDemographicsResponse](docs/InstagramDemographicsResponse.md)
|
|
1344
1349
|
- [Zernio::InstagramDemographicsResponseDemographicsValueInner](docs/InstagramDemographicsResponseDemographicsValueInner.md)
|
|
1345
1350
|
- [Zernio::InstagramPlatformData](docs/InstagramPlatformData.md)
|
data/docs/AdCampaignsApi.md
CHANGED
|
@@ -834,6 +834,7 @@ opts = {
|
|
|
834
834
|
platform: 'facebook', # String |
|
|
835
835
|
status: Zernio::AdStatus::ACTIVE, # AdStatus | Filter by derived campaign status (post-aggregation)
|
|
836
836
|
ad_account_id: 'ad_account_id_example', # String | Platform ad account ID
|
|
837
|
+
page_id: 'page_id_example', # String | Meta only: Facebook Page ID. Prunes the tree to ads whose creative is backed by this Page — campaigns and ad sets with no ad on the Page drop out, and rolled-up metrics cover only the Page's ads. Mirrors the same filter on /v1/ads and /v1/ads/campaigns.
|
|
837
838
|
account_id: 'account_id_example', # String | Social account ID
|
|
838
839
|
profile_id: 'profile_id_example', # String | Profile ID
|
|
839
840
|
campaign_id: 'campaign_id_example', # String | Restrict the tree to a single campaign by its platform campaign id (the id the platform assigns, e.g. Meta's numeric campaign id). Filters the campaign set itself, so it works regardless of account size and pagination — pass this when you already hold a campaign id instead of paging the tree to find it. Mirrors the `campaignId` filter on GET /v1/ads.
|
|
@@ -881,6 +882,7 @@ end
|
|
|
881
882
|
| **platform** | **String** | | [optional] |
|
|
882
883
|
| **status** | [**AdStatus**](.md) | Filter by derived campaign status (post-aggregation) | [optional] |
|
|
883
884
|
| **ad_account_id** | **String** | Platform ad account ID | [optional] |
|
|
885
|
+
| **page_id** | **String** | Meta only: Facebook Page ID. Prunes the tree to ads whose creative is backed by this Page — campaigns and ad sets with no ad on the Page drop out, and rolled-up metrics cover only the Page's ads. Mirrors the same filter on /v1/ads and /v1/ads/campaigns. | [optional] |
|
|
884
886
|
| **account_id** | **String** | Social account ID | [optional] |
|
|
885
887
|
| **profile_id** | **String** | Profile ID | [optional] |
|
|
886
888
|
| **campaign_id** | **String** | Restrict the tree to a single campaign by its platform campaign id (the id the platform assigns, e.g. Meta's numeric campaign id). Filters the campaign set itself, so it works regardless of account size and pagination — pass this when you already hold a campaign id instead of paging the tree to find it. Mirrors the `campaignId` filter on GET /v1/ads. | [optional] |
|
|
@@ -1010,6 +1012,7 @@ opts = {
|
|
|
1010
1012
|
platform: 'facebook', # String |
|
|
1011
1013
|
status: Zernio::AdStatus::ACTIVE, # AdStatus | Filter by derived campaign status (post-aggregation)
|
|
1012
1014
|
ad_account_id: 'ad_account_id_example', # String | Platform ad account ID (e.g. act_123 for Meta)
|
|
1015
|
+
page_id: 'page_id_example', # String | Meta only: Facebook Page ID. Campaigns have no Page of their own, so this keeps campaigns having at least one ad backed by this Page, with adCount and metrics computed over those ads only. Mirrors the same filter on /v1/ads and /v1/ads/tree.
|
|
1013
1016
|
account_id: 'account_id_example', # String | Social account ID
|
|
1014
1017
|
profile_id: 'profile_id_example', # String | Profile ID
|
|
1015
1018
|
from_date: Date.parse('2013-10-20'), # Date | Start of metrics date range (YYYY-MM-DD, inclusive). Defaults to 90 days ago when both date params are omitted.
|
|
@@ -1053,6 +1056,7 @@ end
|
|
|
1053
1056
|
| **platform** | **String** | | [optional] |
|
|
1054
1057
|
| **status** | [**AdStatus**](.md) | Filter by derived campaign status (post-aggregation) | [optional] |
|
|
1055
1058
|
| **ad_account_id** | **String** | Platform ad account ID (e.g. act_123 for Meta) | [optional] |
|
|
1059
|
+
| **page_id** | **String** | Meta only: Facebook Page ID. Campaigns have no Page of their own, so this keeps campaigns having at least one ad backed by this Page, with adCount and metrics computed over those ads only. Mirrors the same filter on /v1/ads and /v1/ads/tree. | [optional] |
|
|
1056
1060
|
| **account_id** | **String** | Social account ID | [optional] |
|
|
1057
1061
|
| **profile_id** | **String** | Profile ID | [optional] |
|
|
1058
1062
|
| **from_date** | **Date** | Start of metrics date range (YYYY-MM-DD, inclusive). Defaults to 90 days ago when both date params are omitted. | [optional] |
|
|
@@ -1191,6 +1195,7 @@ opts = {
|
|
|
1191
1195
|
platform: 'facebook', # String |
|
|
1192
1196
|
account_id: 'account_id_example', # String | Social account ID
|
|
1193
1197
|
ad_account_id: 'ad_account_id_example', # String | Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1198
|
+
page_id: 'page_id_example', # String | Meta only: Facebook Page ID. Returns only ads whose creative is backed by this Page (a Meta ad account serves ads for every Page in the Business Manager). Matches each ad's `creative.pageId`; ads with no page signal (rare IG-only creatives) never match. Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1194
1199
|
profile_id: 'profile_id_example', # String | Profile ID
|
|
1195
1200
|
campaign_id: 'campaign_id_example', # String | Platform campaign ID (filter ads within a campaign)
|
|
1196
1201
|
platform_ad_id: 'platform_ad_id_example', # String | Meta ad ID. Returns the ad with this platform-side ad ID.
|
|
@@ -1238,6 +1243,7 @@ end
|
|
|
1238
1243
|
| **platform** | **String** | | [optional] |
|
|
1239
1244
|
| **account_id** | **String** | Social account ID | [optional] |
|
|
1240
1245
|
| **ad_account_id** | **String** | Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree. | [optional] |
|
|
1246
|
+
| **page_id** | **String** | Meta only: Facebook Page ID. Returns only ads whose creative is backed by this Page (a Meta ad account serves ads for every Page in the Business Manager). Matches each ad's `creative.pageId`; ads with no page signal (rare IG-only creatives) never match. Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree. | [optional] |
|
|
1241
1247
|
| **profile_id** | **String** | Profile ID | [optional] |
|
|
1242
1248
|
| **campaign_id** | **String** | Platform campaign ID (filter ads within a campaign) | [optional] |
|
|
1243
1249
|
| **platform_ad_id** | **String** | Meta ad ID. Returns the ad with this platform-side ad ID. | [optional] |
|
data/docs/AdCreative.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
| **object_type** | **String** | Meta creative object_type (e.g. SHARE, VIDEO, PRIVACY_CHECK_FAIL, POST_DELETED). Use this to render state-aware previews — when Meta moderation strips image/video fields, only thumbnailUrl at 64x64 is available. | [optional] |
|
|
12
12
|
| **object_story_id** | **String** | Meta creative `object_story_id` (the SHARE reference). Frequently absent — Meta omits it for SHARE creatives. Use effectiveObjectStoryId instead. | [optional] |
|
|
13
13
|
| **effective_object_story_id** | **String** | Meta `effective_object_story_id` — `{pageId}_{postId}` of the Facebook post the ad's engagement (comments) lives on. Pass to GET /v1/ads?effectiveObjectStoryId= to map a Business-Manager-visible post back to this ad; GET /v1/ads/{adId}/comments resolves comments against it. | [optional] |
|
|
14
|
+
| **page_id** | **String** | Facebook Page backing the creative (Meta only). What the `pageId` filter on /v1/ads, /v1/ads/campaigns and /v1/ads/tree matches against. Absent for non-Meta ads and rare Meta creatives with no page signal. | [optional] |
|
|
14
15
|
| **effective_instagram_media_id** | **String** | Meta `effective_instagram_media_id` — the Instagram media ID of the boosted post the ad's engagement lives on. Pass to GET /v1/ads?effectiveInstagramMediaId= to map a Business-Manager-visible IG post back to this ad. | [optional] |
|
|
15
16
|
| **instagram_user_id** | **String** | Meta `instagram_user_id` — the Instagram-scoped business ID that owns the boosted media. | [optional] |
|
|
16
17
|
| **instagram_permalink_url** | **String** | Meta `instagram_permalink_url` — public Instagram post URL of the boosted media. | [optional] |
|
|
@@ -36,6 +37,7 @@ instance = Zernio::AdCreative.new(
|
|
|
36
37
|
object_type: null,
|
|
37
38
|
object_story_id: null,
|
|
38
39
|
effective_object_story_id: null,
|
|
40
|
+
page_id: null,
|
|
39
41
|
effective_instagram_media_id: null,
|
|
40
42
|
instagram_user_id: null,
|
|
41
43
|
instagram_permalink_url: null,
|
data/docs/AnalyticsApi.md
CHANGED
|
@@ -9,6 +9,7 @@ All URIs are relative to *https://zernio.com/api*
|
|
|
9
9
|
| [**get_content_decay**](AnalyticsApi.md#get_content_decay) | **GET** /v1/analytics/content-decay | Get content performance decay |
|
|
10
10
|
| [**get_daily_metrics**](AnalyticsApi.md#get_daily_metrics) | **GET** /v1/analytics/daily-metrics | Get daily aggregated metrics |
|
|
11
11
|
| [**get_facebook_page_insights**](AnalyticsApi.md#get_facebook_page_insights) | **GET** /v1/analytics/facebook/page-insights | Get Facebook Page insights |
|
|
12
|
+
| [**get_facebook_post_earnings**](AnalyticsApi.md#get_facebook_post_earnings) | **GET** /v1/analytics/facebook/post-earnings | Get Facebook post monetization earnings |
|
|
12
13
|
| [**get_facebook_post_reactions**](AnalyticsApi.md#get_facebook_post_reactions) | **GET** /v1/accounts/{accountId}/facebook-post-reactions | Get Facebook post reactions |
|
|
13
14
|
| [**get_follower_stats**](AnalyticsApi.md#get_follower_stats) | **GET** /v1/accounts/follower-stats | Get follower stats |
|
|
14
15
|
| [**get_google_business_performance**](AnalyticsApi.md#get_google_business_performance) | **GET** /v1/analytics/googlebusiness/performance | Get GBP performance metrics |
|
|
@@ -380,7 +381,7 @@ end
|
|
|
380
381
|
api_instance = Zernio::AnalyticsApi.new
|
|
381
382
|
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the connected Facebook Page.
|
|
382
383
|
opts = {
|
|
383
|
-
metrics: 'metrics_example', # String | Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost
|
|
384
|
+
metrics: 'metrics_example', # String | Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost Monetization (opt-in, not in the defaults): - content_monetization_earnings - monetization_approximate_earnings Each monetization metric is fetched with its own separate Graph call, so requesting both adds two calls. Values are approximate and Meta restates them after the fact. content_monetization_earnings returns an object per day and always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings returns a bare number per day, so its unit is always \"unspecified\" and its \"currency\" is always null. The two are on different scales and are not comparable to each other. Both keep their daily \"values\" on every metricType and are never rescaled by Zernio. Earnings here are Page-level daily buckets and \"total\" is their sum. Meta does not document whether a bucket carries that day's earnings or a running total, and every Page measured so far earned exactly 0, so reconcile \"total\" against the Page's own Meta export before relying on it; the daily \"values\" are always returned for that purpose. Per-post lifetime earnings are served by GET /v1/analytics/facebook/post-earnings. A Page that is not enrolled in monetization, or that earned nothing, returns normal daily buckets of 0 in \"metrics\": Meta does not distinguish the two, so a 0 total here does NOT mean the Page is enrolled. \"unavailableMetrics\" covers the narrower case where Meta returned no bucket for the metric at all (\"no_data\") or rejected the request outright, and the metric is then omitted from \"metrics\" rather than reported as 0.
|
|
384
385
|
since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
|
|
385
386
|
_until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
|
|
386
387
|
metric_type: 'time_series' # String | \"total_value\" (default) returns aggregated totals only. \"time_series\" returns daily values in the \"values\" array.
|
|
@@ -418,7 +419,7 @@ end
|
|
|
418
419
|
| Name | Type | Description | Notes |
|
|
419
420
|
| ---- | ---- | ----------- | ----- |
|
|
420
421
|
| **account_id** | **String** | The Zernio SocialAccount ID for the connected Facebook Page. | |
|
|
421
|
-
| **metrics** | **String** | Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost | [optional] |
|
|
422
|
+
| **metrics** | **String** | Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost Monetization (opt-in, not in the defaults): - content_monetization_earnings - monetization_approximate_earnings Each monetization metric is fetched with its own separate Graph call, so requesting both adds two calls. Values are approximate and Meta restates them after the fact. content_monetization_earnings returns an object per day and always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings returns a bare number per day, so its unit is always \"unspecified\" and its \"currency\" is always null. The two are on different scales and are not comparable to each other. Both keep their daily \"values\" on every metricType and are never rescaled by Zernio. Earnings here are Page-level daily buckets and \"total\" is their sum. Meta does not document whether a bucket carries that day's earnings or a running total, and every Page measured so far earned exactly 0, so reconcile \"total\" against the Page's own Meta export before relying on it; the daily \"values\" are always returned for that purpose. Per-post lifetime earnings are served by GET /v1/analytics/facebook/post-earnings. A Page that is not enrolled in monetization, or that earned nothing, returns normal daily buckets of 0 in \"metrics\": Meta does not distinguish the two, so a 0 total here does NOT mean the Page is enrolled. \"unavailableMetrics\" covers the narrower case where Meta returned no bucket for the metric at all (\"no_data\") or rejected the request outright, and the metric is then omitted from \"metrics\" rather than reported as 0. | [optional] |
|
|
422
423
|
| **since** | **Date** | Start date (YYYY-MM-DD). Defaults to 30 days ago. | [optional] |
|
|
423
424
|
| **_until** | **Date** | End date (YYYY-MM-DD). Defaults to today. | [optional] |
|
|
424
425
|
| **metric_type** | **String** | \"total_value\" (default) returns aggregated totals only. \"time_series\" returns daily values in the \"values\" array. | [optional][default to 'total_value'] |
|
|
@@ -437,6 +438,81 @@ end
|
|
|
437
438
|
- **Accept**: application/json
|
|
438
439
|
|
|
439
440
|
|
|
441
|
+
## get_facebook_post_earnings
|
|
442
|
+
|
|
443
|
+
> <FacebookPostEarningsResponse> get_facebook_post_earnings(account_id, post_id, opts)
|
|
444
|
+
|
|
445
|
+
Get Facebook post monetization earnings
|
|
446
|
+
|
|
447
|
+
Returns lifetime monetization earnings for ONE Facebook post, read live from Meta on every request. Requires the Analytics add-on. Earnings are CUMULATIVE since the post was published, not earnings within a date range, so this endpoint takes no since/until and the totals must not be summed across dates or across posts. Page-level daily earnings live on /v1/analytics/facebook/page-insights. A post on a Page that is not enrolled in monetization, or that earned nothing, returns \"total\": 0 rather than an error: Meta does not distinguish the two. A metric Meta returned no bucket for at all is reported in \"unavailableMetrics\" and omitted from \"metrics\", never as a 0. Amounts are the platform's raw numbers in the stated \"unit\" and are never rescaled by Zernio. Breakdown dimensions are not exposed and a \"breakdown\" param is rejected with 400. So are \"since\", \"until\", \"period\", and \"metricType\": scoping this endpoint to a window is not possible, and silently returning the lifetime total for one would let a caller sum a year of weekly requests into a figure ~52x the post's real earnings.
|
|
448
|
+
|
|
449
|
+
### Examples
|
|
450
|
+
|
|
451
|
+
```ruby
|
|
452
|
+
require 'time'
|
|
453
|
+
require 'zernio-sdk'
|
|
454
|
+
# setup authorization
|
|
455
|
+
Zernio.configure do |config|
|
|
456
|
+
# Configure Bearer authorization (JWT): bearerAuth
|
|
457
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
api_instance = Zernio::AnalyticsApi.new
|
|
461
|
+
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the connected Facebook Page.
|
|
462
|
+
post_id = 'post_id_example' # String | The platform post ID, exactly as returned in platformAnalytics[].platformPostId by /v1/analytics: \"{pageId}_{postId}\", or the bare video ID for Reels.
|
|
463
|
+
opts = {
|
|
464
|
+
metrics: 'metrics_example' # String | Comma-separated list of monetization metrics. Defaults to both: - content_monetization_earnings - monetization_approximate_earnings content_monetization_earnings always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings is always a bare number, so its unit is \"unspecified\" and its \"currency\" is null. The two are on different scales and are not comparable to each other. Any other metric name is rejected with 400.
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
begin
|
|
468
|
+
# Get Facebook post monetization earnings
|
|
469
|
+
result = api_instance.get_facebook_post_earnings(account_id, post_id, opts)
|
|
470
|
+
p result
|
|
471
|
+
rescue Zernio::ApiError => e
|
|
472
|
+
puts "Error when calling AnalyticsApi->get_facebook_post_earnings: #{e}"
|
|
473
|
+
end
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
#### Using the get_facebook_post_earnings_with_http_info variant
|
|
477
|
+
|
|
478
|
+
This returns an Array which contains the response data, status code and headers.
|
|
479
|
+
|
|
480
|
+
> <Array(<FacebookPostEarningsResponse>, Integer, Hash)> get_facebook_post_earnings_with_http_info(account_id, post_id, opts)
|
|
481
|
+
|
|
482
|
+
```ruby
|
|
483
|
+
begin
|
|
484
|
+
# Get Facebook post monetization earnings
|
|
485
|
+
data, status_code, headers = api_instance.get_facebook_post_earnings_with_http_info(account_id, post_id, opts)
|
|
486
|
+
p status_code # => 2xx
|
|
487
|
+
p headers # => { ... }
|
|
488
|
+
p data # => <FacebookPostEarningsResponse>
|
|
489
|
+
rescue Zernio::ApiError => e
|
|
490
|
+
puts "Error when calling AnalyticsApi->get_facebook_post_earnings_with_http_info: #{e}"
|
|
491
|
+
end
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Parameters
|
|
495
|
+
|
|
496
|
+
| Name | Type | Description | Notes |
|
|
497
|
+
| ---- | ---- | ----------- | ----- |
|
|
498
|
+
| **account_id** | **String** | The Zernio SocialAccount ID for the connected Facebook Page. | |
|
|
499
|
+
| **post_id** | **String** | The platform post ID, exactly as returned in platformAnalytics[].platformPostId by /v1/analytics: \"{pageId}_{postId}\", or the bare video ID for Reels. | |
|
|
500
|
+
| **metrics** | **String** | Comma-separated list of monetization metrics. Defaults to both: - content_monetization_earnings - monetization_approximate_earnings content_monetization_earnings always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings is always a bare number, so its unit is \"unspecified\" and its \"currency\" is null. The two are on different scales and are not comparable to each other. Any other metric name is rejected with 400. | [optional] |
|
|
501
|
+
|
|
502
|
+
### Return type
|
|
503
|
+
|
|
504
|
+
[**FacebookPostEarningsResponse**](FacebookPostEarningsResponse.md)
|
|
505
|
+
|
|
506
|
+
### Authorization
|
|
507
|
+
|
|
508
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
509
|
+
|
|
510
|
+
### HTTP request headers
|
|
511
|
+
|
|
512
|
+
- **Content-Type**: Not defined
|
|
513
|
+
- **Accept**: application/json
|
|
514
|
+
|
|
515
|
+
|
|
440
516
|
## get_facebook_post_reactions
|
|
441
517
|
|
|
442
518
|
> <GetFacebookPostReactions200Response> get_facebook_post_reactions(account_id, post_id)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Zernio::FacebookPostEarningsResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **success** | **Boolean** | | [optional] |
|
|
8
|
+
| **account_id** | **String** | | [optional] |
|
|
9
|
+
| **post_id** | **String** | The platform post ID that was queried, echoed back. | [optional] |
|
|
10
|
+
| **platform** | **String** | | [optional] |
|
|
11
|
+
| **period** | **String** | Always \"lifetime\": the total is cumulative since publication and must not be summed across dates or across posts. | [optional] |
|
|
12
|
+
| **metrics** | [**Hash<String, FacebookPostEarningsResponseMetricsValue>**](FacebookPostEarningsResponseMetricsValue.md) | One entry per served metric. A metric reported here with \"total\": 0 genuinely earned nothing (or its Page is not enrolled, which Meta reports identically). | [optional] |
|
|
13
|
+
| **unavailable_metrics** | [**Array<FacebookPostEarningsResponseUnavailableMetricsInner>**](FacebookPostEarningsResponseUnavailableMetricsInner.md) | Requested metrics Meta could not serve. Present only when at least one metric is unavailable, and absent otherwise. Each listed metric is OMITTED from \"metrics\" rather than reported as 0. The request itself still succeeds with HTTP 200. | [optional] |
|
|
14
|
+
| **data_delay** | **String** | | [optional] |
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
require 'zernio-sdk'
|
|
20
|
+
|
|
21
|
+
instance = Zernio::FacebookPostEarningsResponse.new(
|
|
22
|
+
success: true,
|
|
23
|
+
account_id: 64e1a2b3c4d5e6f7a8b9c0d1,
|
|
24
|
+
post_id: 123456789_987654321,
|
|
25
|
+
platform: facebook,
|
|
26
|
+
period: null,
|
|
27
|
+
metrics: null,
|
|
28
|
+
unavailable_metrics: null,
|
|
29
|
+
data_delay: null
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Zernio::FacebookPostEarningsResponseMetricsValue
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **total** | **Float** | Lifetime earnings in \"unit\", exactly as Meta returned them. Never rescaled. | [optional] |
|
|
8
|
+
| **unit** | **String** | \"micro_amount\": Meta returned an object shape carrying a micro amount, and \"total\" is that integer, unconverted. Zernio does not publish a divisor because Meta does not document one; divide by the scale you have verified against the Page's own Meta Business Suite export. This is always content_monetization_earnings. \"unspecified\": Meta returned a bare number with no unit metadata, passed through as-is; Meta does not state whether it is major or minor currency units. This is always monetization_approximate_earnings. | [optional] |
|
|
9
|
+
| **currency** | **String** | ISO 4217 currency, or null when Meta omitted it. Always null on monetization_approximate_earnings; always present on content_monetization_earnings. | [optional] |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'zernio-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Zernio::FacebookPostEarningsResponseMetricsValue.new(
|
|
17
|
+
total: null,
|
|
18
|
+
unit: null,
|
|
19
|
+
currency: USD
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Zernio::FacebookPostEarningsResponseUnavailableMetricsInner
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **metric** | **String** | The requested metric name. | [optional] |
|
|
8
|
+
| **reason** | **String** | \"not_enrolled\": the account is not enrolled in the program behind this metric. \"permission_missing\": the connected user lacks access to this metric. \"unsupported_metric\": Meta does not accept this metric name on the API version Zernio uses. \"no_data\": Meta returned no bucket for this metric. \"unreadable_value\": Meta returned a value shape Zernio cannot read, so no total is reported. \"mixed_currency\": readable values disagree on currency or unit. \"upstream_error\": any other platform failure. \"no_data\" is the common case in practice; the others are defensive. | [optional] |
|
|
9
|
+
| **message** | **String** | Platform-provided explanation when available (access tokens redacted), otherwise Zernio copy. | [optional] |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'zernio-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Zernio::FacebookPostEarningsResponseUnavailableMetricsInner.new(
|
|
17
|
+
metric: null,
|
|
18
|
+
reason: null,
|
|
19
|
+
message: null
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
| **date_range** | [**InstagramAccountInsightsResponseDateRange**](InstagramAccountInsightsResponseDateRange.md) | | [optional] |
|
|
11
11
|
| **metric_type** | **String** | | [optional] |
|
|
12
12
|
| **breakdown** | **String** | Breakdown dimension used (only present when breakdown was requested) | [optional] |
|
|
13
|
-
| **metrics** | [**Hash<String, InstagramAccountInsightsResponseMetricsValue>**](InstagramAccountInsightsResponseMetricsValue.md) | Object keyed by metric name. For time_series: each metric has \"total\" (number) and \"values\" (array of {date, value}). For total_value: each metric has \"total\" (number) and optionally \"breakdowns\" (array of {dimension, value}). | [optional] |
|
|
13
|
+
| **metrics** | [**Hash<String, InstagramAccountInsightsResponseMetricsValue>**](InstagramAccountInsightsResponseMetricsValue.md) | Object keyed by metric name. For time_series: each metric has \"total\" (number) and \"values\" (array of {date, value}). For total_value: each metric has \"total\" (number) and optionally \"breakdowns\" (array of {dimension, value}). Monetary metrics additionally carry \"unit\" and \"currency\". Zernio never rescales money: \"total\" and every \"values[].value\" are the platform's raw numbers in the stated unit. Monetary metrics also keep \"values\" on metricType=total_value, because their \"total\" is the sum of the daily buckets the platform returned over the range: keep the series so you can reconcile that sum against the platform's own reporting before invoicing on it. A metric that could not be served is absent from this object and listed in \"unavailableMetrics\" instead, so an unavailable metric is never reported as a zero. | [optional] |
|
|
14
|
+
| **unavailable_metrics** | [**Array<InstagramAccountInsightsResponseUnavailableMetricsInner>**](InstagramAccountInsightsResponseUnavailableMetricsInner.md) | Requested metrics that could not be served. Present only when at least one metric is unavailable, and absent otherwise. Each listed metric is OMITTED from \"metrics\" rather than reported as 0, which is how an unavailable metric is distinguished from a genuine zero. The request itself still succeeds with HTTP 200. | [optional] |
|
|
14
15
|
| **data_delay** | **String** | | [optional] |
|
|
15
16
|
|
|
16
17
|
## Example
|
|
@@ -26,6 +27,7 @@ instance = Zernio::InstagramAccountInsightsResponse.new(
|
|
|
26
27
|
metric_type: null,
|
|
27
28
|
breakdown: null,
|
|
28
29
|
metrics: null,
|
|
30
|
+
unavailable_metrics: null,
|
|
29
31
|
data_delay: Data may be delayed up to 48 hours
|
|
30
32
|
)
|
|
31
33
|
```
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **total** | **Float** | Sum or aggregate value for the metric | [optional] |
|
|
8
|
-
| **values** | [**Array<InstagramAccountInsightsResponseMetricsValueValuesInner>**](InstagramAccountInsightsResponseMetricsValueValuesInner.md) | Daily values (
|
|
8
|
+
| **values** | [**Array<InstagramAccountInsightsResponseMetricsValueValuesInner>**](InstagramAccountInsightsResponseMetricsValueValuesInner.md) | Daily values (for time_series, and always on monetary metrics) | [optional] |
|
|
9
9
|
| **breakdowns** | [**Array<InstagramAccountInsightsResponseMetricsValueBreakdownsInner>**](InstagramAccountInsightsResponseMetricsValueBreakdownsInner.md) | Breakdown values (only for total_value with breakdown) | [optional] |
|
|
10
|
+
| **unit** | **String** | Present on monetary metrics only. The scale of \"total\" and of every \"values[].value\", exactly as the platform returned them. \"micro_amount\": the platform returned an object shape carrying a micro amount, and the values are that integer, summed, unconverted. Zernio does not publish a divisor because Meta does not document one; divide by the scale you have verified against the Page's own Meta Business Suite export. On Facebook Page insights this is always content_monetization_earnings. \"unspecified\": the platform returned a bare number with no unit metadata. It is passed through as-is; the platform does not state whether it is major or minor currency units. On Facebook Page insights this is always monetization_approximate_earnings. | [optional] |
|
|
11
|
+
| **currency** | **String** | ISO 4217 currency of a monetary metric, or null when the platform omitted it. Always null on monetization_approximate_earnings, which Meta returns as a bare number with no currency; always present on content_monetization_earnings. | [optional] |
|
|
10
12
|
|
|
11
13
|
## Example
|
|
12
14
|
|
|
@@ -16,7 +18,9 @@ require 'zernio-sdk'
|
|
|
16
18
|
instance = Zernio::InstagramAccountInsightsResponseMetricsValue.new(
|
|
17
19
|
total: null,
|
|
18
20
|
values: null,
|
|
19
|
-
breakdowns: null
|
|
21
|
+
breakdowns: null,
|
|
22
|
+
unit: null,
|
|
23
|
+
currency: USD
|
|
20
24
|
)
|
|
21
25
|
```
|
|
22
26
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Zernio::InstagramAccountInsightsResponseUnavailableMetricsInner
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **metric** | **String** | The requested metric name. | [optional] |
|
|
8
|
+
| **reason** | **String** | \"not_enrolled\": the account is not enrolled in the program behind this metric. \"permission_missing\": the connected user lacks access to this metric. \"unsupported_metric\": the platform does not accept this metric name on the API version Zernio uses. \"no_data\": the platform returned no bucket for this metric over the requested range. \"unreadable_value\": the platform returned a value shape Zernio cannot read, so no total is reported. \"mixed_currency\": readable values disagree on currency or unit within the range. \"upstream_error\": any other platform failure. \"no_data\" is the common case in practice. The others are defensive: \"not_enrolled\" and \"unsupported_metric\" in particular have not been observed on live Facebook traffic, since a non-enrolled Page returns zeros rather than an error and metric names are validated before any platform call. | [optional] |
|
|
9
|
+
| **message** | **String** | Platform-provided explanation when available (access tokens redacted), otherwise Zernio copy. | [optional] |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'zernio-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Zernio::InstagramAccountInsightsResponseUnavailableMetricsInner.new(
|
|
17
|
+
metric: null,
|
|
18
|
+
reason: null,
|
|
19
|
+
message: null
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -798,6 +798,7 @@ module Zernio
|
|
|
798
798
|
# @option opts [String] :platform
|
|
799
799
|
# @option opts [AdStatus] :status Filter by derived campaign status (post-aggregation)
|
|
800
800
|
# @option opts [String] :ad_account_id Platform ad account ID
|
|
801
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Prunes the tree to ads whose creative is backed by this Page — campaigns and ad sets with no ad on the Page drop out, and rolled-up metrics cover only the Page's ads. Mirrors the same filter on /v1/ads and /v1/ads/campaigns.
|
|
801
802
|
# @option opts [String] :account_id Social account ID
|
|
802
803
|
# @option opts [String] :profile_id Profile ID
|
|
803
804
|
# @option opts [String] :campaign_id Restrict the tree to a single campaign by its platform campaign id (the id the platform assigns, e.g. Meta's numeric campaign id). Filters the campaign set itself, so it works regardless of account size and pagination — pass this when you already hold a campaign id instead of paging the tree to find it. Mirrors the `campaignId` filter on GET /v1/ads.
|
|
@@ -821,6 +822,7 @@ module Zernio
|
|
|
821
822
|
# @option opts [String] :platform
|
|
822
823
|
# @option opts [AdStatus] :status Filter by derived campaign status (post-aggregation)
|
|
823
824
|
# @option opts [String] :ad_account_id Platform ad account ID
|
|
825
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Prunes the tree to ads whose creative is backed by this Page — campaigns and ad sets with no ad on the Page drop out, and rolled-up metrics cover only the Page's ads. Mirrors the same filter on /v1/ads and /v1/ads/campaigns.
|
|
824
826
|
# @option opts [String] :account_id Social account ID
|
|
825
827
|
# @option opts [String] :profile_id Profile ID
|
|
826
828
|
# @option opts [String] :campaign_id Restrict the tree to a single campaign by its platform campaign id (the id the platform assigns, e.g. Meta's numeric campaign id). Filters the campaign set itself, so it works regardless of account size and pagination — pass this when you already hold a campaign id instead of paging the tree to find it. Mirrors the `campaignId` filter on GET /v1/ads.
|
|
@@ -877,6 +879,7 @@ module Zernio
|
|
|
877
879
|
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
878
880
|
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
879
881
|
query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
|
|
882
|
+
query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil?
|
|
880
883
|
query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
|
|
881
884
|
query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
|
|
882
885
|
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
|
|
@@ -1009,6 +1012,7 @@ module Zernio
|
|
|
1009
1012
|
# @option opts [String] :platform
|
|
1010
1013
|
# @option opts [AdStatus] :status Filter by derived campaign status (post-aggregation)
|
|
1011
1014
|
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta)
|
|
1015
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Campaigns have no Page of their own, so this keeps campaigns having at least one ad backed by this Page, with adCount and metrics computed over those ads only. Mirrors the same filter on /v1/ads and /v1/ads/tree.
|
|
1012
1016
|
# @option opts [String] :account_id Social account ID
|
|
1013
1017
|
# @option opts [String] :profile_id Profile ID
|
|
1014
1018
|
# @option opts [Date] :from_date Start of metrics date range (YYYY-MM-DD, inclusive). Defaults to 90 days ago when both date params are omitted.
|
|
@@ -1028,6 +1032,7 @@ module Zernio
|
|
|
1028
1032
|
# @option opts [String] :platform
|
|
1029
1033
|
# @option opts [AdStatus] :status Filter by derived campaign status (post-aggregation)
|
|
1030
1034
|
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta)
|
|
1035
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Campaigns have no Page of their own, so this keeps campaigns having at least one ad backed by this Page, with adCount and metrics computed over those ads only. Mirrors the same filter on /v1/ads and /v1/ads/tree.
|
|
1031
1036
|
# @option opts [String] :account_id Social account ID
|
|
1032
1037
|
# @option opts [String] :profile_id Profile ID
|
|
1033
1038
|
# @option opts [Date] :from_date Start of metrics date range (YYYY-MM-DD, inclusive). Defaults to 90 days ago when both date params are omitted.
|
|
@@ -1068,6 +1073,7 @@ module Zernio
|
|
|
1068
1073
|
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
1069
1074
|
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
1070
1075
|
query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
|
|
1076
|
+
query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil?
|
|
1071
1077
|
query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
|
|
1072
1078
|
query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
|
|
1073
1079
|
query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
|
|
@@ -1231,6 +1237,7 @@ module Zernio
|
|
|
1231
1237
|
# @option opts [String] :platform
|
|
1232
1238
|
# @option opts [String] :account_id Social account ID
|
|
1233
1239
|
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1240
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Returns only ads whose creative is backed by this Page (a Meta ad account serves ads for every Page in the Business Manager). Matches each ad's `creative.pageId`; ads with no page signal (rare IG-only creatives) never match. Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1234
1241
|
# @option opts [String] :profile_id Profile ID
|
|
1235
1242
|
# @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
|
|
1236
1243
|
# @option opts [String] :platform_ad_id Meta ad ID. Returns the ad with this platform-side ad ID.
|
|
@@ -1254,6 +1261,7 @@ module Zernio
|
|
|
1254
1261
|
# @option opts [String] :platform
|
|
1255
1262
|
# @option opts [String] :account_id Social account ID
|
|
1256
1263
|
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1264
|
+
# @option opts [String] :page_id Meta only: Facebook Page ID. Returns only ads whose creative is backed by this Page (a Meta ad account serves ads for every Page in the Business Manager). Matches each ad's `creative.pageId`; ads with no page signal (rare IG-only creatives) never match. Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
|
|
1257
1265
|
# @option opts [String] :profile_id Profile ID
|
|
1258
1266
|
# @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
|
|
1259
1267
|
# @option opts [String] :platform_ad_id Meta ad ID. Returns the ad with this platform-side ad ID.
|
|
@@ -1298,6 +1306,7 @@ module Zernio
|
|
|
1298
1306
|
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
1299
1307
|
query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
|
|
1300
1308
|
query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
|
|
1309
|
+
query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil?
|
|
1301
1310
|
query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
|
|
1302
1311
|
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
|
|
1303
1312
|
query_params[:'platformAdId'] = opts[:'platform_ad_id'] if !opts[:'platform_ad_id'].nil?
|
|
@@ -369,7 +369,7 @@ module Zernio
|
|
|
369
369
|
# Returns page-level Facebook insights (media views, views, post engagements, video metrics, follower counts). Response shape matches /v1/analytics/instagram/account-insights so the same client handling works across platforms. Metric names track the current (post-November 2025) Meta Graph API. The legacy page_impressions / page_fans / page_fan_adds / page_fan_removes metrics were deprecated by Meta on November 15, 2025 and are NOT accepted by this endpoint. Use the replacements below. Because Meta did not provide direct adds/removes replacements, Zernio synthesizes followers_gained / followers_lost from the daily follower snapshotter. Max 89 days, defaults to last 30 days. Requires the Analytics add-on.
|
|
370
370
|
# @param account_id [String] The Zernio SocialAccount ID for the connected Facebook Page.
|
|
371
371
|
# @param [Hash] opts the optional parameters
|
|
372
|
-
# @option opts [String] :metrics Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost
|
|
372
|
+
# @option opts [String] :metrics Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost Monetization (opt-in, not in the defaults): - content_monetization_earnings - monetization_approximate_earnings Each monetization metric is fetched with its own separate Graph call, so requesting both adds two calls. Values are approximate and Meta restates them after the fact. content_monetization_earnings returns an object per day and always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings returns a bare number per day, so its unit is always \"unspecified\" and its \"currency\" is always null. The two are on different scales and are not comparable to each other. Both keep their daily \"values\" on every metricType and are never rescaled by Zernio. Earnings here are Page-level daily buckets and \"total\" is their sum. Meta does not document whether a bucket carries that day's earnings or a running total, and every Page measured so far earned exactly 0, so reconcile \"total\" against the Page's own Meta export before relying on it; the daily \"values\" are always returned for that purpose. Per-post lifetime earnings are served by GET /v1/analytics/facebook/post-earnings. A Page that is not enrolled in monetization, or that earned nothing, returns normal daily buckets of 0 in \"metrics\": Meta does not distinguish the two, so a 0 total here does NOT mean the Page is enrolled. \"unavailableMetrics\" covers the narrower case where Meta returned no bucket for the metric at all (\"no_data\") or rejected the request outright, and the metric is then omitted from \"metrics\" rather than reported as 0.
|
|
373
373
|
# @option opts [Date] :since Start date (YYYY-MM-DD). Defaults to 30 days ago.
|
|
374
374
|
# @option opts [Date] :_until End date (YYYY-MM-DD). Defaults to today.
|
|
375
375
|
# @option opts [String] :metric_type \"total_value\" (default) returns aggregated totals only. \"time_series\" returns daily values in the \"values\" array. (default to 'total_value')
|
|
@@ -383,7 +383,7 @@ module Zernio
|
|
|
383
383
|
# Returns page-level Facebook insights (media views, views, post engagements, video metrics, follower counts). Response shape matches /v1/analytics/instagram/account-insights so the same client handling works across platforms. Metric names track the current (post-November 2025) Meta Graph API. The legacy page_impressions / page_fans / page_fan_adds / page_fan_removes metrics were deprecated by Meta on November 15, 2025 and are NOT accepted by this endpoint. Use the replacements below. Because Meta did not provide direct adds/removes replacements, Zernio synthesizes followers_gained / followers_lost from the daily follower snapshotter. Max 89 days, defaults to last 30 days. Requires the Analytics add-on.
|
|
384
384
|
# @param account_id [String] The Zernio SocialAccount ID for the connected Facebook Page.
|
|
385
385
|
# @param [Hash] opts the optional parameters
|
|
386
|
-
# @option opts [String] :metrics Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost
|
|
386
|
+
# @option opts [String] :metrics Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\". Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost Monetization (opt-in, not in the defaults): - content_monetization_earnings - monetization_approximate_earnings Each monetization metric is fetched with its own separate Graph call, so requesting both adds two calls. Values are approximate and Meta restates them after the fact. content_monetization_earnings returns an object per day and always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings returns a bare number per day, so its unit is always \"unspecified\" and its \"currency\" is always null. The two are on different scales and are not comparable to each other. Both keep their daily \"values\" on every metricType and are never rescaled by Zernio. Earnings here are Page-level daily buckets and \"total\" is their sum. Meta does not document whether a bucket carries that day's earnings or a running total, and every Page measured so far earned exactly 0, so reconcile \"total\" against the Page's own Meta export before relying on it; the daily \"values\" are always returned for that purpose. Per-post lifetime earnings are served by GET /v1/analytics/facebook/post-earnings. A Page that is not enrolled in monetization, or that earned nothing, returns normal daily buckets of 0 in \"metrics\": Meta does not distinguish the two, so a 0 total here does NOT mean the Page is enrolled. \"unavailableMetrics\" covers the narrower case where Meta returned no bucket for the metric at all (\"no_data\") or rejected the request outright, and the metric is then omitted from \"metrics\" rather than reported as 0.
|
|
387
387
|
# @option opts [Date] :since Start date (YYYY-MM-DD). Defaults to 30 days ago.
|
|
388
388
|
# @option opts [Date] :_until End date (YYYY-MM-DD). Defaults to today.
|
|
389
389
|
# @option opts [String] :metric_type \"total_value\" (default) returns aggregated totals only. \"time_series\" returns daily values in the \"values\" array. (default to 'total_value')
|
|
@@ -445,6 +445,80 @@ module Zernio
|
|
|
445
445
|
return data, status_code, headers
|
|
446
446
|
end
|
|
447
447
|
|
|
448
|
+
# Get Facebook post monetization earnings
|
|
449
|
+
# Returns lifetime monetization earnings for ONE Facebook post, read live from Meta on every request. Requires the Analytics add-on. Earnings are CUMULATIVE since the post was published, not earnings within a date range, so this endpoint takes no since/until and the totals must not be summed across dates or across posts. Page-level daily earnings live on /v1/analytics/facebook/page-insights. A post on a Page that is not enrolled in monetization, or that earned nothing, returns \"total\": 0 rather than an error: Meta does not distinguish the two. A metric Meta returned no bucket for at all is reported in \"unavailableMetrics\" and omitted from \"metrics\", never as a 0. Amounts are the platform's raw numbers in the stated \"unit\" and are never rescaled by Zernio. Breakdown dimensions are not exposed and a \"breakdown\" param is rejected with 400. So are \"since\", \"until\", \"period\", and \"metricType\": scoping this endpoint to a window is not possible, and silently returning the lifetime total for one would let a caller sum a year of weekly requests into a figure ~52x the post's real earnings.
|
|
450
|
+
# @param account_id [String] The Zernio SocialAccount ID for the connected Facebook Page.
|
|
451
|
+
# @param post_id [String] The platform post ID, exactly as returned in platformAnalytics[].platformPostId by /v1/analytics: \"{pageId}_{postId}\", or the bare video ID for Reels.
|
|
452
|
+
# @param [Hash] opts the optional parameters
|
|
453
|
+
# @option opts [String] :metrics Comma-separated list of monetization metrics. Defaults to both: - content_monetization_earnings - monetization_approximate_earnings content_monetization_earnings always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings is always a bare number, so its unit is \"unspecified\" and its \"currency\" is null. The two are on different scales and are not comparable to each other. Any other metric name is rejected with 400.
|
|
454
|
+
# @return [FacebookPostEarningsResponse]
|
|
455
|
+
def get_facebook_post_earnings(account_id, post_id, opts = {})
|
|
456
|
+
data, _status_code, _headers = get_facebook_post_earnings_with_http_info(account_id, post_id, opts)
|
|
457
|
+
data
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# Get Facebook post monetization earnings
|
|
461
|
+
# Returns lifetime monetization earnings for ONE Facebook post, read live from Meta on every request. Requires the Analytics add-on. Earnings are CUMULATIVE since the post was published, not earnings within a date range, so this endpoint takes no since/until and the totals must not be summed across dates or across posts. Page-level daily earnings live on /v1/analytics/facebook/page-insights. A post on a Page that is not enrolled in monetization, or that earned nothing, returns \"total\": 0 rather than an error: Meta does not distinguish the two. A metric Meta returned no bucket for at all is reported in \"unavailableMetrics\" and omitted from \"metrics\", never as a 0. Amounts are the platform's raw numbers in the stated \"unit\" and are never rescaled by Zernio. Breakdown dimensions are not exposed and a \"breakdown\" param is rejected with 400. So are \"since\", \"until\", \"period\", and \"metricType\": scoping this endpoint to a window is not possible, and silently returning the lifetime total for one would let a caller sum a year of weekly requests into a figure ~52x the post's real earnings.
|
|
462
|
+
# @param account_id [String] The Zernio SocialAccount ID for the connected Facebook Page.
|
|
463
|
+
# @param post_id [String] The platform post ID, exactly as returned in platformAnalytics[].platformPostId by /v1/analytics: \"{pageId}_{postId}\", or the bare video ID for Reels.
|
|
464
|
+
# @param [Hash] opts the optional parameters
|
|
465
|
+
# @option opts [String] :metrics Comma-separated list of monetization metrics. Defaults to both: - content_monetization_earnings - monetization_approximate_earnings content_monetization_earnings always carries unit \"micro_amount\" plus an ISO 4217 \"currency\". monetization_approximate_earnings is always a bare number, so its unit is \"unspecified\" and its \"currency\" is null. The two are on different scales and are not comparable to each other. Any other metric name is rejected with 400.
|
|
466
|
+
# @return [Array<(FacebookPostEarningsResponse, Integer, Hash)>] FacebookPostEarningsResponse data, response status code and response headers
|
|
467
|
+
def get_facebook_post_earnings_with_http_info(account_id, post_id, opts = {})
|
|
468
|
+
if @api_client.config.debugging
|
|
469
|
+
@api_client.config.logger.debug 'Calling API: AnalyticsApi.get_facebook_post_earnings ...'
|
|
470
|
+
end
|
|
471
|
+
# verify the required parameter 'account_id' is set
|
|
472
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
473
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_facebook_post_earnings"
|
|
474
|
+
end
|
|
475
|
+
# verify the required parameter 'post_id' is set
|
|
476
|
+
if @api_client.config.client_side_validation && post_id.nil?
|
|
477
|
+
fail ArgumentError, "Missing the required parameter 'post_id' when calling AnalyticsApi.get_facebook_post_earnings"
|
|
478
|
+
end
|
|
479
|
+
# resource path
|
|
480
|
+
local_var_path = '/v1/analytics/facebook/post-earnings'
|
|
481
|
+
|
|
482
|
+
# query parameters
|
|
483
|
+
query_params = opts[:query_params] || {}
|
|
484
|
+
query_params[:'accountId'] = account_id
|
|
485
|
+
query_params[:'postId'] = post_id
|
|
486
|
+
query_params[:'metrics'] = opts[:'metrics'] if !opts[:'metrics'].nil?
|
|
487
|
+
|
|
488
|
+
# header parameters
|
|
489
|
+
header_params = opts[:header_params] || {}
|
|
490
|
+
# HTTP header 'Accept' (if needed)
|
|
491
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
492
|
+
|
|
493
|
+
# form parameters
|
|
494
|
+
form_params = opts[:form_params] || {}
|
|
495
|
+
|
|
496
|
+
# http body (model)
|
|
497
|
+
post_body = opts[:debug_body]
|
|
498
|
+
|
|
499
|
+
# return_type
|
|
500
|
+
return_type = opts[:debug_return_type] || 'FacebookPostEarningsResponse'
|
|
501
|
+
|
|
502
|
+
# auth_names
|
|
503
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
504
|
+
|
|
505
|
+
new_options = opts.merge(
|
|
506
|
+
:operation => :"AnalyticsApi.get_facebook_post_earnings",
|
|
507
|
+
:header_params => header_params,
|
|
508
|
+
:query_params => query_params,
|
|
509
|
+
:form_params => form_params,
|
|
510
|
+
:body => post_body,
|
|
511
|
+
:auth_names => auth_names,
|
|
512
|
+
:return_type => return_type
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
516
|
+
if @api_client.config.debugging
|
|
517
|
+
@api_client.config.logger.debug "API called: AnalyticsApi#get_facebook_post_earnings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
518
|
+
end
|
|
519
|
+
return data, status_code, headers
|
|
520
|
+
end
|
|
521
|
+
|
|
448
522
|
# Get Facebook post reactions
|
|
449
523
|
# Returns the reaction breakdown for a Facebook Page post: a count per reaction type plus the overall total. The whole breakdown is fetched in a single Graph call. Note that the post analytics endpoint reports only an aggregate reaction count (surfaced there as `likes`), so use this endpoint when you need per-type counts.
|
|
450
524
|
# @param account_id [String] The ID of the Facebook Page account
|