zernio-sdk 0.0.643 → 0.0.645
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/docs/AdCampaignsApi.md +3 -3
- data/docs/AdDailyMetrics.md +1 -1
- data/docs/AdMetrics.md +1 -1
- data/docs/AdTreeAdSet.md +1 -1
- data/docs/AdTreeCampaign.md +1 -1
- data/docs/CreateStandaloneAdRequestPromotedObject.md +1 -1
- data/docs/GetAdsTimeline200ResponseRowsInner.md +1 -1
- data/docs/GetCampaignAnalytics200ResponseAnalyticsDailyInner.md +1 -1
- data/docs/TrackingTagsApi.md +1 -1
- data/lib/zernio-sdk/api/ad_campaigns_api.rb +4 -4
- data/lib/zernio-sdk/api/tracking_tags_api.rb +2 -2
- data/lib/zernio-sdk/models/ad_daily_metrics.rb +2 -1
- data/lib/zernio-sdk/models/ad_metrics.rb +1 -0
- data/lib/zernio-sdk/models/ad_tree_ad_set.rb +1 -1
- data/lib/zernio-sdk/models/ad_tree_campaign.rb +1 -1
- data/lib/zernio-sdk/models/create_standalone_ad_request_promoted_object.rb +1 -1
- data/lib/zernio-sdk/models/get_ads_timeline200_response_rows_inner.rb +1 -0
- data/lib/zernio-sdk/models/get_campaign_analytics200_response_analytics_daily_inner.rb +1 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/openapi.yaml +27 -6
- data/spec/api/ad_campaigns_api_spec.rb +2 -2
- data/spec/api/tracking_tags_api_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e6ecd3d38e913620f08433d3a6106f008ec394b2a6b1da992fa11ff16a5ff91
|
|
4
|
+
data.tar.gz: bb5d940bb8c8c70372ecc865850089d4448bdde4d0f7b87d57b86fca5b811b2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e49bbebce3fa993c702c91800b4c49b084141e561c22c4cf690b4d276e0409060f7ab3df0dfcf9a9874a6421901b2404537637c5b6d93a95b1b79993a7c656b
|
|
7
|
+
data.tar.gz: deda078b6f581f6834e4e56ebf2c381695c730ec5770a6a6a91a0b7e7519e0defdf3568f7f7b975140c7e0ce75363c493d69ae1651411063f70a9b4f3b95e0b2
|
data/docs/AdCampaignsApi.md
CHANGED
|
@@ -827,7 +827,7 @@ end
|
|
|
827
827
|
|
|
828
828
|
Get campaign tree
|
|
829
829
|
|
|
830
|
-
Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
|
|
830
|
+
Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. **Deleted objects stay in the tree.** Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on `status` if your view should hide them, but do that after reading the totals, not before.
|
|
831
831
|
|
|
832
832
|
### Examples
|
|
833
833
|
|
|
@@ -855,7 +855,7 @@ opts = {
|
|
|
855
855
|
from_date: Date.parse('2013-10-20'), # Date | Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago.
|
|
856
856
|
to_date: Date.parse('2013-10-20'), # Date | End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
857
857
|
sort: 'newest', # String | Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end.
|
|
858
|
-
time_increment: 1, # Integer | Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics
|
|
858
|
+
time_increment: 1, # Integer | Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it.
|
|
859
859
|
daily_level: 'campaign' # String | Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset.
|
|
860
860
|
}
|
|
861
861
|
|
|
@@ -903,7 +903,7 @@ end
|
|
|
903
903
|
| **from_date** | **Date** | Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago. | [optional] |
|
|
904
904
|
| **to_date** | **Date** | End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range. | [optional] |
|
|
905
905
|
| **sort** | **String** | Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end. | [optional][default to 'newest'] |
|
|
906
|
-
| **time_increment** | **Integer** | Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`
|
|
906
|
+
| **time_increment** | **Integer** | Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it. | [optional] |
|
|
907
907
|
| **daily_level** | **String** | Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset. | [optional][default to 'campaign'] |
|
|
908
908
|
|
|
909
909
|
### Return type
|
data/docs/AdDailyMetrics.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **spend** | **Float** | | [optional] |
|
|
8
8
|
| **impressions** | **Integer** | | [optional] |
|
|
9
|
-
| **reach** | **Integer** |
|
|
9
|
+
| **reach** | **Integer** | Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta. | [optional] |
|
|
10
10
|
| **clicks** | **Integer** | | [optional] |
|
|
11
11
|
| **ctr** | **Float** | Click-through rate (%) | [optional] |
|
|
12
12
|
| **cpc** | **Float** | Cost per click | [optional] |
|
data/docs/AdMetrics.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **spend** | **Float** | | [optional] |
|
|
8
8
|
| **impressions** | **Integer** | | [optional] |
|
|
9
|
-
| **reach** | **Integer** |
|
|
9
|
+
| **reach** | **Integer** | Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta. | [optional] |
|
|
10
10
|
| **clicks** | **Integer** | | [optional] |
|
|
11
11
|
| **ctr** | **Float** | Click-through rate (%) | [optional] |
|
|
12
12
|
| **cpc** | **Float** | Cost per click | [optional] |
|
data/docs/AdTreeAdSet.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
| **cost_type** | **String** | LinkedIn only. Effective cost model (billing event) of the LinkedIn campaign backing this ad set: CPM, CPC or CPV. Null for non-LinkedIn ad sets. | [optional] |
|
|
19
19
|
| **serving_statuses** | **Array<String>** | LinkedIn only. Why the LinkedIn campaign backing this ad set is (or is not) delivering. A LinkedIn Campaign maps to this ad-set node, so this is the level where LinkedIn's holds actually apply. Empty means no serving data, [\"RUNNABLE\"] means eligible to serve, anything else is a hold. See the `servingStatuses` field on `Ad` for the known values. | [optional] |
|
|
20
20
|
| **promoted_object** | [**AdTreeAdSetPromotedObject**](AdTreeAdSetPromotedObject.md) | | [optional] |
|
|
21
|
-
| **ads** | [**Array<Ad>**](Ad.md) | Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation
|
|
21
|
+
| **ads** | [**Array<Ad>**](Ad.md) | Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation: `_id`, `name`, `platform`, `status`, `configuredStatus`, `reviewStatus`, `budget`, `metrics`, `creative`, `goal` and the `platform*` ids are always included; `targeting` and `schedule` may be absent. `configuredStatus` (the ad's own on/off toggle) and `reviewStatus` (the platform's review verdict) are part of this contract, not incidental: a rejected ad is only distinguishable from a healthy one through `reviewStatus`. When `timeIncrement=1&dailyLevel=ad`, each entry also carries a `daily[]` array of `AdDailyMetrics`. | [optional] |
|
|
22
22
|
| **daily** | [**Array<AdDailyMetrics>**](AdDailyMetrics.md) | Per-day metric series for this ad set. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` and `dailyLevel` is `adset` or `ad`. | [optional] |
|
|
23
23
|
|
|
24
24
|
## Example
|
data/docs/AdTreeCampaign.md
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
| **roas_average_floor** | **Float** | Representative ROAS floor for the campaign — bubbled up from the top-spending ad set. Decimal multiplier (2.0 = 2.0x). | [optional] |
|
|
32
32
|
| **promoted_object** | [**AdTreeCampaignPromotedObject**](AdTreeCampaignPromotedObject.md) | | [optional] |
|
|
33
33
|
| **ad_sets** | [**Array<AdTreeAdSet>**](AdTreeAdSet.md) | | [optional] |
|
|
34
|
-
| **daily** | [**Array<AdDailyMetrics>**](AdDailyMetrics.md) | Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total. | [optional] |
|
|
34
|
+
| **daily** | [**Array<AdDailyMetrics>**](AdDailyMetrics.md) | Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total, except `reach`: on Meta the range total is de-duplicated, so daily reach does not sum to it. | [optional] |
|
|
35
35
|
|
|
36
36
|
## Example
|
|
37
37
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **pixel_id** | **String** | Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`. **TikTok:** TikTok Pixel ID, required for `goal: conversions`. | [optional] |
|
|
7
|
+
| **pixel_id** | **String** | Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`. **TikTok:** TikTok Pixel ID, required for `goal: conversions`. To discover the pixels an ad account can use, call `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (each entry carries `kind` and `ownerAdAccountId`), or `GET /v1/accounts/{accountId}/conversion-destinations`. Note this is a different resource from `GET /v1/ads/{adId}/tracking-tags`, which reads an ad's click-URL params (`url_tags`), not pixels. | [optional] |
|
|
8
8
|
| **custom_event_type** | **String** | The event the campaign/ad group optimises against. **Meta:** standard event like `PURCHASE`, `LEAD`, `COMPLETE_REGISTRATION`, `ADD_TO_CART`. Uppercased internally so callers can pass any case. Required for `goal: conversions`. **TikTok:** an `optimization_event` code (UPPER_SNAKE, not Meta's vocabulary and not PascalCase), OR the exact event name shown in TikTok Events Manager (auto-resolved to its code). Must be one of the event types your TikTok Pixel tracks; custom events are not optimizable. Current taxonomy: `SHOPPING` (Purchase), `ON_WEB_CART` (Add to Cart), `INITIATE_ORDER` (Initiate Checkout), `FORM` (Lead), `ON_WEB_REGISTER` (Complete Registration), `ON_WEB_DETAIL` (View Content). `ON_WEB_ORDER` is deprecated. On rejection the error lists the event types your pixel actually tracks. Optional for `goal: conversions`. | [optional] |
|
|
9
9
|
| **page_id** | **String** | Facebook Page ID. Used by `goal: lead_generation`. Auto-filled from the connected Page when omitted. | [optional] |
|
|
10
10
|
| **application_id** | **String** | App ID. Required for `goal: app_promotion`. | [optional] |
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
| **date** | **Date** | | [optional] |
|
|
8
8
|
| **spend** | **Float** | Native currency units (matches /ads/tree convention). | [optional] |
|
|
9
9
|
| **impressions** | **Integer** | | [optional] |
|
|
10
|
-
| **reach** | **Integer** |
|
|
10
|
+
| **reach** | **Integer** | Reach summed across the account's ads for this single day. A person seen by two ads the same day counts twice, and reach is de-duplicated per day only: do NOT sum it across days (people reached on multiple days would be double-counted). | [optional] |
|
|
11
11
|
| **clicks** | **Integer** | | [optional] |
|
|
12
12
|
| **engagement** | **Integer** | | [optional] |
|
|
13
13
|
| **ctr** | **Float** | Click-through rate as a percentage (0–100). | [optional] |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **spend** | **Float** | | [optional] |
|
|
8
8
|
| **impressions** | **Integer** | | [optional] |
|
|
9
|
-
| **reach** | **Integer** |
|
|
9
|
+
| **reach** | **Integer** | Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta. | [optional] |
|
|
10
10
|
| **clicks** | **Integer** | | [optional] |
|
|
11
11
|
| **ctr** | **Float** | Click-through rate (%) | [optional] |
|
|
12
12
|
| **cpc** | **Float** | Cost per click | [optional] |
|
data/docs/TrackingTagsApi.md
CHANGED
|
@@ -166,7 +166,7 @@ end
|
|
|
166
166
|
|
|
167
167
|
Get ad tracking tags
|
|
168
168
|
|
|
169
|
-
Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
|
|
169
|
+
Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest). **Not pixels.** Despite the shared path segment, this endpoint has nothing to do with measurement tags. For an ad account's pixels use `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (Meta Pixels, with `kind` and `ownerAdAccountId`) or `GET /v1/accounts/{accountId}/conversion-destinations`.
|
|
170
170
|
|
|
171
171
|
### Examples
|
|
172
172
|
|
|
@@ -818,7 +818,7 @@ module Zernio
|
|
|
818
818
|
end
|
|
819
819
|
|
|
820
820
|
# Get campaign tree
|
|
821
|
-
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
|
|
821
|
+
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. **Deleted objects stay in the tree.** Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on `status` if your view should hide them, but do that after reading the totals, not before.
|
|
822
822
|
# @param [Hash] opts the optional parameters
|
|
823
823
|
# @option opts [Integer] :page Page number (1-based) (default to 1)
|
|
824
824
|
# @option opts [Integer] :limit Campaigns per page (default to 20)
|
|
@@ -833,7 +833,7 @@ module Zernio
|
|
|
833
833
|
# @option opts [Date] :from_date Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago.
|
|
834
834
|
# @option opts [Date] :to_date End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
835
835
|
# @option opts [String] :sort Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end. (default to 'newest')
|
|
836
|
-
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`
|
|
836
|
+
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it.
|
|
837
837
|
# @option opts [String] :daily_level Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset. (default to 'campaign')
|
|
838
838
|
# @return [GetAdTree200Response]
|
|
839
839
|
def get_ad_tree(opts = {})
|
|
@@ -842,7 +842,7 @@ module Zernio
|
|
|
842
842
|
end
|
|
843
843
|
|
|
844
844
|
# Get campaign tree
|
|
845
|
-
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
|
|
845
|
+
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. **Deleted objects stay in the tree.** Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on `status` if your view should hide them, but do that after reading the totals, not before.
|
|
846
846
|
# @param [Hash] opts the optional parameters
|
|
847
847
|
# @option opts [Integer] :page Page number (1-based) (default to 1)
|
|
848
848
|
# @option opts [Integer] :limit Campaigns per page (default to 20)
|
|
@@ -857,7 +857,7 @@ module Zernio
|
|
|
857
857
|
# @option opts [Date] :from_date Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago.
|
|
858
858
|
# @option opts [Date] :to_date End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
859
859
|
# @option opts [String] :sort Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end. (default to 'newest')
|
|
860
|
-
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`
|
|
860
|
+
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it.
|
|
861
861
|
# @option opts [String] :daily_level Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset. (default to 'campaign')
|
|
862
862
|
# @return [Array<(GetAdTree200Response, Integer, Hash)>] GetAdTree200Response data, response status code and response headers
|
|
863
863
|
def get_ad_tree_with_http_info(opts = {})
|
|
@@ -174,7 +174,7 @@ module Zernio
|
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
# Get ad tracking tags
|
|
177
|
-
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
|
|
177
|
+
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest). **Not pixels.** Despite the shared path segment, this endpoint has nothing to do with measurement tags. For an ad account's pixels use `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (Meta Pixels, with `kind` and `ownerAdAccountId`) or `GET /v1/accounts/{accountId}/conversion-destinations`.
|
|
178
178
|
# @param ad_id [String] Ad id (hex _id, platformAdId, or effective story/media id).
|
|
179
179
|
# @param [Hash] opts the optional parameters
|
|
180
180
|
# @return [GetAdTrackingTags200Response]
|
|
@@ -184,7 +184,7 @@ module Zernio
|
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
# Get ad tracking tags
|
|
187
|
-
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
|
|
187
|
+
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest). **Not pixels.** Despite the shared path segment, this endpoint has nothing to do with measurement tags. For an ad account's pixels use `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (Meta Pixels, with `kind` and `ownerAdAccountId`) or `GET /v1/accounts/{accountId}/conversion-destinations`.
|
|
188
188
|
# @param ad_id [String] Ad id (hex _id, platformAdId, or effective story/media id).
|
|
189
189
|
# @param [Hash] opts the optional parameters
|
|
190
190
|
# @return [Array<(GetAdTrackingTags200Response, Integer, Hash)>] GetAdTrackingTags200Response data, response status code and response headers
|
|
@@ -14,12 +14,13 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Zernio
|
|
17
|
-
# One day of metrics. Same fields as `AdMetrics` plus the `date` they apply to. Returned inside a node's `daily[]` when `GET /v1/ads/tree` is called with `timeIncrement=1`. Rate metrics (ctr/cpc/cpm/costPerConversion/ roas/videoAvgTimeWatchedActions) are recomputed per day from that day's sums, so summing the additive fields across a node's `daily[]` reproduces its aggregated `metrics` total. Do NOT sum or plain-average `videoAvgTimeWatchedActions` across days: the range value is the play-weighted average of the daily values.
|
|
17
|
+
# One day of metrics. Same fields as `AdMetrics` plus the `date` they apply to. Returned inside a node's `daily[]` when `GET /v1/ads/tree` is called with `timeIncrement=1`. Rate metrics (ctr/cpc/cpm/costPerConversion/ roas/videoAvgTimeWatchedActions) are recomputed per day from that day's sums, so summing the additive fields across a node's `daily[]` reproduces its aggregated `metrics` total. `reach` is the exception: on Meta the aggregated total is de-duplicated across the range, so daily reach does not sum to it. Do NOT sum or plain-average `videoAvgTimeWatchedActions` across days: the range value is the play-weighted average of the daily values.
|
|
18
18
|
class AdDailyMetrics < ApiModelBase
|
|
19
19
|
attr_accessor :spend
|
|
20
20
|
|
|
21
21
|
attr_accessor :impressions
|
|
22
22
|
|
|
23
|
+
# Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta.
|
|
23
24
|
attr_accessor :reach
|
|
24
25
|
|
|
25
26
|
attr_accessor :clicks
|
|
@@ -19,6 +19,7 @@ module Zernio
|
|
|
19
19
|
|
|
20
20
|
attr_accessor :impressions
|
|
21
21
|
|
|
22
|
+
# Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta.
|
|
22
23
|
attr_accessor :reach
|
|
23
24
|
|
|
24
25
|
attr_accessor :clicks
|
|
@@ -50,7 +50,7 @@ module Zernio
|
|
|
50
50
|
|
|
51
51
|
attr_accessor :promoted_object
|
|
52
52
|
|
|
53
|
-
# Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation
|
|
53
|
+
# Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation: `_id`, `name`, `platform`, `status`, `configuredStatus`, `reviewStatus`, `budget`, `metrics`, `creative`, `goal` and the `platform*` ids are always included; `targeting` and `schedule` may be absent. `configuredStatus` (the ad's own on/off toggle) and `reviewStatus` (the platform's review verdict) are part of this contract, not incidental: a rejected ad is only distinguishable from a healthy one through `reviewStatus`. When `timeIncrement=1&dailyLevel=ad`, each entry also carries a `daily[]` array of `AdDailyMetrics`.
|
|
54
54
|
attr_accessor :ads
|
|
55
55
|
|
|
56
56
|
# Per-day metric series for this ad set. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` and `dailyLevel` is `adset` or `ad`.
|
|
@@ -83,7 +83,7 @@ module Zernio
|
|
|
83
83
|
|
|
84
84
|
attr_accessor :ad_sets
|
|
85
85
|
|
|
86
|
-
# Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total.
|
|
86
|
+
# Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total, except `reach`: on Meta the range total is de-duplicated, so daily reach does not sum to it.
|
|
87
87
|
attr_accessor :daily
|
|
88
88
|
|
|
89
89
|
class EnumAttributeValidator
|
|
@@ -16,7 +16,7 @@ require 'time'
|
|
|
16
16
|
module Zernio
|
|
17
17
|
# What the ad optimises against. Behaviour depends on the platform. **Meta**: forwarded to the ad set's `promoted_object` (snake-cased). Required for goals whose ad-set optimization_goal points at a specific event/page/app (without it Meta rejects the ad-set create with `error_subcode: 1815430` \"Please select a promoted object for your ad set\"): - `goal: conversions` / `lead_conversion` (OFFSITE_CONVERSIONS): requires `pixelId` + `customEventType`, or `customConversionId` when optimising against a Custom Conversion (the conversion carries its own event definition) - `goal: app_promotion` (APP_INSTALLS): requires `applicationId` + `objectStoreUrl` - `goal: lead_generation` (LEAD_GENERATION): `pageId` is auto-filled from the connected Page when omitted Other Meta goals (engagement, traffic, awareness, video_views) ignore this field. **TikTok**: only `goal: conversions` uses it. - `pixelId` maps to the ad group's `pixel_id`. Required: a TikTok website-conversion ad group without a pixel is rejected with `40002: Please select a pixel`. - `customEventType` maps to the ad group's `optimization_event` (the pixel event to optimise for). Optional: TikTok accepts a pixel-only auto-bid conversion ad group. See the `customEventType` field below for the valid TikTok codes. The remaining `promotedObject.*` fields are Meta-only. Platforms other than Meta and TikTok ignore `promotedObject` entirely.
|
|
18
18
|
class CreateStandaloneAdRequestPromotedObject < ApiModelBase
|
|
19
|
-
# Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`. **TikTok:** TikTok Pixel ID, required for `goal: conversions`.
|
|
19
|
+
# Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`. **TikTok:** TikTok Pixel ID, required for `goal: conversions`. To discover the pixels an ad account can use, call `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (each entry carries `kind` and `ownerAdAccountId`), or `GET /v1/accounts/{accountId}/conversion-destinations`. Note this is a different resource from `GET /v1/ads/{adId}/tracking-tags`, which reads an ad's click-URL params (`url_tags`), not pixels.
|
|
20
20
|
attr_accessor :pixel_id
|
|
21
21
|
|
|
22
22
|
# The event the campaign/ad group optimises against. **Meta:** standard event like `PURCHASE`, `LEAD`, `COMPLETE_REGISTRATION`, `ADD_TO_CART`. Uppercased internally so callers can pass any case. Required for `goal: conversions`. **TikTok:** an `optimization_event` code (UPPER_SNAKE, not Meta's vocabulary and not PascalCase), OR the exact event name shown in TikTok Events Manager (auto-resolved to its code). Must be one of the event types your TikTok Pixel tracks; custom events are not optimizable. Current taxonomy: `SHOPPING` (Purchase), `ON_WEB_CART` (Add to Cart), `INITIATE_ORDER` (Initiate Checkout), `FORM` (Lead), `ON_WEB_REGISTER` (Complete Registration), `ON_WEB_DETAIL` (View Content). `ON_WEB_ORDER` is deprecated. On rejection the error lists the event types your pixel actually tracks. Optional for `goal: conversions`.
|
|
@@ -22,6 +22,7 @@ module Zernio
|
|
|
22
22
|
|
|
23
23
|
attr_accessor :impressions
|
|
24
24
|
|
|
25
|
+
# Reach summed across the account's ads for this single day. A person seen by two ads the same day counts twice, and reach is de-duplicated per day only: do NOT sum it across days (people reached on multiple days would be double-counted).
|
|
25
26
|
attr_accessor :reach
|
|
26
27
|
|
|
27
28
|
attr_accessor :clicks
|
|
@@ -19,6 +19,7 @@ module Zernio
|
|
|
19
19
|
|
|
20
20
|
attr_accessor :impressions
|
|
21
21
|
|
|
22
|
+
# Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta.
|
|
22
23
|
attr_accessor :reach
|
|
23
24
|
|
|
24
25
|
attr_accessor :clicks
|
data/lib/zernio-sdk/version.rb
CHANGED
data/openapi.yaml
CHANGED
|
@@ -6562,7 +6562,9 @@ components:
|
|
|
6562
6562
|
properties:
|
|
6563
6563
|
spend: { type: number }
|
|
6564
6564
|
impressions: { type: integer }
|
|
6565
|
-
reach:
|
|
6565
|
+
reach:
|
|
6566
|
+
type: integer
|
|
6567
|
+
description: "Unique people reached in the requested date range. Meta (facebook/instagram): Meta's own de-duplicated reach for the exact range, fetched live and cached up to ~1 hour (may lag recent delivery; on a transient Meta error the value temporarily falls back to a sum of per-day reach, which overcounts people reached on multiple days or by multiple child ads). Because it is de-duplicated, Meta reach is NOT additive: neither daily values nor child nodes sum to the range total. TikTok: sum of per-day reach, so multi-day ranges overcount vs TikTok Ads Manager. Google, LinkedIn, X, Pinterest and OpenAI report 0 (reach not synced). Only derive frequency (impressions / reach) for Meta."
|
|
6566
6568
|
clicks: { type: integer }
|
|
6567
6569
|
ctr: { type: number, description: Click-through rate (%) }
|
|
6568
6570
|
cpc: { type: number, description: Cost per click }
|
|
@@ -6618,7 +6620,9 @@ components:
|
|
|
6618
6620
|
called with `timeIncrement=1`. Rate metrics (ctr/cpc/cpm/costPerConversion/
|
|
6619
6621
|
roas/videoAvgTimeWatchedActions) are recomputed per day from that day's
|
|
6620
6622
|
sums, so summing the additive fields across a node's `daily[]` reproduces
|
|
6621
|
-
its aggregated `metrics` total.
|
|
6623
|
+
its aggregated `metrics` total. `reach` is the exception: on Meta the
|
|
6624
|
+
aggregated total is de-duplicated across the range, so daily reach does
|
|
6625
|
+
not sum to it. Do NOT sum or plain-average
|
|
6622
6626
|
`videoAvgTimeWatchedActions` across days: the range value is the
|
|
6623
6627
|
play-weighted average of the daily values.
|
|
6624
6628
|
allOf:
|
|
@@ -7088,7 +7092,7 @@ components:
|
|
|
7088
7092
|
ads:
|
|
7089
7093
|
type: array
|
|
7090
7094
|
items: { $ref: '#/components/schemas/Ad' }
|
|
7091
|
-
description: Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation
|
|
7095
|
+
description: "Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation: `_id`, `name`, `platform`, `status`, `configuredStatus`, `reviewStatus`, `budget`, `metrics`, `creative`, `goal` and the `platform*` ids are always included; `targeting` and `schedule` may be absent. `configuredStatus` (the ad's own on/off toggle) and `reviewStatus` (the platform's review verdict) are part of this contract, not incidental: a rejected ad is only distinguishable from a healthy one through `reviewStatus`. When `timeIncrement=1&dailyLevel=ad`, each entry also carries a `daily[]` array of `AdDailyMetrics`."
|
|
7092
7096
|
daily:
|
|
7093
7097
|
type: array
|
|
7094
7098
|
items: { $ref: '#/components/schemas/AdDailyMetrics' }
|
|
@@ -7177,7 +7181,7 @@ components:
|
|
|
7177
7181
|
daily:
|
|
7178
7182
|
type: array
|
|
7179
7183
|
items: { $ref: '#/components/schemas/AdDailyMetrics' }
|
|
7180
|
-
description: "Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total."
|
|
7184
|
+
description: "Per-day metric series for this campaign. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` (any `dailyLevel`). This is the per-campaign daily trend — summing its additive fields reproduces the campaign `metrics` total, except `reach`: on Meta the range total is de-duplicated, so daily reach does not sum to it."
|
|
7181
7185
|
AdCampaign:
|
|
7182
7186
|
type: object
|
|
7183
7187
|
properties:
|
|
@@ -35751,6 +35755,12 @@ paths:
|
|
|
35751
35755
|
per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel`
|
|
35752
35756
|
(`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces
|
|
35753
35757
|
calling the tree once per day for per-campaign daily trends.
|
|
35758
|
+
|
|
35759
|
+
**Deleted objects stay in the tree.** Deleting an ad or a campaign is a soft delete: the Ad
|
|
35760
|
+
documents move to `status: cancelled` and are kept indefinitely, so their historical spend
|
|
35761
|
+
still counts toward the metrics of any date range they fall in. There is no pruning job and
|
|
35762
|
+
no retention window. Filter on `status` if your view should hide them, but do that after
|
|
35763
|
+
reading the totals, not before.
|
|
35754
35764
|
security:
|
|
35755
35765
|
- bearerAuth: []
|
|
35756
35766
|
parameters:
|
|
@@ -35767,7 +35777,7 @@ paths:
|
|
|
35767
35777
|
- { name: fromDate, in: query, schema: { type: string, format: date }, description: "Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago." }
|
|
35768
35778
|
- { name: toDate, in: query, schema: { type: string, format: date }, description: "End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range." }
|
|
35769
35779
|
- { name: sort, in: query, schema: { type: string, enum: [newest, oldest, spend_desc, spend_asc], default: newest }, description: "Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end." }
|
|
35770
|
-
- { name: timeIncrement, in: query, schema: { type: integer, enum: [1] }, description: "Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics
|
|
35780
|
+
- { name: timeIncrement, in: query, schema: { type: integer, enum: [1] }, description: "Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it." }
|
|
35771
35781
|
- { name: dailyLevel, in: query, schema: { type: string, enum: [campaign, adset, ad], default: campaign }, description: "Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset." }
|
|
35772
35782
|
responses:
|
|
35773
35783
|
'200':
|
|
@@ -35834,7 +35844,7 @@ paths:
|
|
|
35834
35844
|
date: { type: string, format: date }
|
|
35835
35845
|
spend: { type: number, description: "Native currency units (matches /ads/tree convention)." }
|
|
35836
35846
|
impressions: { type: integer }
|
|
35837
|
-
reach: { type: integer }
|
|
35847
|
+
reach: { type: integer, description: "Reach summed across the account's ads for this single day. A person seen by two ads the same day counts twice, and reach is de-duplicated per day only: do NOT sum it across days (people reached on multiple days would be double-counted)." }
|
|
35838
35848
|
clicks: { type: integer }
|
|
35839
35849
|
engagement: { type: integer }
|
|
35840
35850
|
ctr: { type: number, description: "Click-through rate as a percentage (0–100)." }
|
|
@@ -36592,6 +36602,11 @@ paths:
|
|
|
36592
36602
|
Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access.
|
|
36593
36603
|
- LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`.
|
|
36594
36604
|
Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
|
|
36605
|
+
|
|
36606
|
+
**Not pixels.** Despite the shared path segment, this endpoint has nothing to do with
|
|
36607
|
+
measurement tags. For an ad account's pixels use
|
|
36608
|
+
`GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (Meta Pixels, with `kind`
|
|
36609
|
+
and `ownerAdAccountId`) or `GET /v1/accounts/{accountId}/conversion-destinations`.
|
|
36595
36610
|
security:
|
|
36596
36611
|
- bearerAuth: []
|
|
36597
36612
|
parameters:
|
|
@@ -38539,6 +38554,12 @@ paths:
|
|
|
38539
38554
|
description: |
|
|
38540
38555
|
Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`.
|
|
38541
38556
|
**TikTok:** TikTok Pixel ID, required for `goal: conversions`.
|
|
38557
|
+
To discover the pixels an ad account can use, call
|
|
38558
|
+
`GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (each entry
|
|
38559
|
+
carries `kind` and `ownerAdAccountId`), or
|
|
38560
|
+
`GET /v1/accounts/{accountId}/conversion-destinations`. Note this is a
|
|
38561
|
+
different resource from `GET /v1/ads/{adId}/tracking-tags`, which reads an
|
|
38562
|
+
ad's click-URL params (`url_tags`), not pixels.
|
|
38542
38563
|
customEventType:
|
|
38543
38564
|
type: string
|
|
38544
38565
|
description: |
|
|
@@ -177,7 +177,7 @@ describe 'AdCampaignsApi' do
|
|
|
177
177
|
|
|
178
178
|
# unit tests for get_ad_tree
|
|
179
179
|
# Get campaign tree
|
|
180
|
-
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
|
|
180
|
+
# Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. **Deleted objects stay in the tree.** Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on `status` if your view should hide them, but do that after reading the totals, not before.
|
|
181
181
|
# @param [Hash] opts the optional parameters
|
|
182
182
|
# @option opts [Integer] :page Page number (1-based)
|
|
183
183
|
# @option opts [Integer] :limit Campaigns per page
|
|
@@ -192,7 +192,7 @@ describe 'AdCampaignsApi' do
|
|
|
192
192
|
# @option opts [Date] :from_date Start of the METRICS date range (YYYY-MM-DD). Affects only the spend/impression numbers overlaid on each node, NOT which campaigns are returned. Defaults to 90 days ago.
|
|
193
193
|
# @option opts [Date] :to_date End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
194
194
|
# @option opts [String] :sort Campaign-level sort order. `newest` (default) / `oldest` order by the campaign's newest-ad createdAt. `spend_desc` / `spend_asc` order by aggregated spend in the requested date range; campaigns with no spend land at the end.
|
|
195
|
-
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`
|
|
195
|
+
# @option opts [Integer] :time_increment Set to `1` to also return a daily breakdown. Mirrors Meta Insights' `time_increment=1`: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) alongside the range total, so you get per-entity daily trends in ONE call instead of calling the tree once per day. Only `1` (daily) is supported. The daily series covers the same date range and uses the same source data as `metrics`, except Meta `reach`: the range total is Meta's de-duplicated value, so daily reach does not sum to it. See `dailyLevel` to control which levels carry it.
|
|
196
196
|
# @option opts [String] :daily_level Which tree levels get the `daily[]` series when `timeIncrement=1`. `campaign` (default) attaches it on campaign nodes only — the common per-campaign-trend case, and the smallest payload. `adset` adds it on ad sets too; `ad` adds it on every ad in `ads[]` as well (heaviest — a long range × up to 100 ads per ad set). Scope with `campaignId` to keep `ad`-level responses small. Ignored when `timeIncrement` is unset.
|
|
197
197
|
# @return [GetAdTree200Response]
|
|
198
198
|
describe 'get_ad_tree test' do
|
|
@@ -61,7 +61,7 @@ describe 'TrackingTagsApi' do
|
|
|
61
61
|
|
|
62
62
|
# unit tests for get_ad_tracking_tags
|
|
63
63
|
# Get ad tracking tags
|
|
64
|
-
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
|
|
64
|
+
# Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest). **Not pixels.** Despite the shared path segment, this endpoint has nothing to do with measurement tags. For an ad account's pixels use `GET /v1/accounts/{accountId}/tracking-tags?adAccountId=act_...` (Meta Pixels, with `kind` and `ownerAdAccountId`) or `GET /v1/accounts/{accountId}/conversion-destinations`.
|
|
65
65
|
# @param ad_id Ad id (hex _id, platformAdId, or effective story/media id).
|
|
66
66
|
# @param [Hash] opts the optional parameters
|
|
67
67
|
# @return [GetAdTrackingTags200Response]
|