@zernio/node 0.2.1512 → 0.2.1514

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.
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@zernio/node",
39
- version: "0.2.1512",
39
+ version: "0.2.1514",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@zernio/node",
8
- version: "0.2.1512",
8
+ version: "0.2.1514",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.1512",
3
+ "version": "0.2.1514",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -12670,7 +12670,7 @@ export const uploadCampaignResults = <ThrowOnError extends boolean = false>(opti
12670
12670
 
12671
12671
  /**
12672
12672
  * List your results per campaign
12673
- * Your results summed per campaign over a date range, one entry per campaign with every metric it has, for the ad accounts your key can see. Each day counts its newest value only.
12673
+ * Your results summed per campaign over a date range, one entry per campaign with every metric it has, for the ad accounts your key can see. Each day counts its newest uploaded value only, plus the events sent to `POST /v1/events` that are tied to the campaign (`sales`, `revenue`, `leads`, `qualified_leads`).
12674
12674
  *
12675
12675
  * Paginated by campaign: pass `nextCursor` back as `cursor` until it is null.
12676
12676
  *
@@ -12700,7 +12700,7 @@ export const getCampaignResultsUpload = <ThrowOnError extends boolean = false>(o
12700
12700
 
12701
12701
  /**
12702
12702
  * Get your results totals
12703
- * Each metric you send summed over a date range across every campaign of the ad accounts your key can see, or of the ones you name. Each day counts its newest value only.
12703
+ * Each metric you send summed over a date range across every campaign of the ad accounts your key can see, or of the ones you name. Each day counts its newest uploaded value only, plus the events sent to `POST /v1/events` that are tied to a campaign.
12704
12704
  *
12705
12705
  * Formulas are not computed here, since they also read the platform's numbers: apply one to these totals and the account's spend for the same range, or read it per campaign from `GET /v1/ads/tree?results=true`.
12706
12706
  *
@@ -18370,6 +18370,8 @@ export const listEvents = <ThrowOnError extends boolean = false>(options: Option
18370
18370
  * - Email, phone and `externalId` are stored only as SHA-256 hashes.
18371
18371
  * - `sourceUrl` keeps only its origin, path and attribution parameters (`utm_*`, `gclid`, `fbclid`, `ttclid`, `li_fat_id`, `epik`, `rdt_cid`, `gbraid`, `wbraid`).
18372
18372
  * - Events sent with `testCode` are forwarded but not stored.
18373
+ * - Sending an event again with the same `eventId` replaces the stored one.
18374
+ * - A stored `Purchase`, `Lead` or `QualifiedLead` tied to one of your campaigns (see `campaign` on each event) counts in `GET /v1/ads/campaign-results` and in ad rules as `sales` and `revenue`, `leads` or `qualified_leads`.
18373
18375
  *
18374
18376
  */
18375
18377
  export const sendEvents = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<SendEventsData, ThrowOnError>) => {
@@ -1804,7 +1804,90 @@ export type AdRuleAction = {
1804
1804
  maxChangesPerObject?: number;
1805
1805
  } | {
1806
1806
  /**
1807
- * Tag the object by its name. Meta, Google and LinkedIn campaigns and ad sets, and TikTok campaigns, ad groups and ads. An object whose name already has the tag (or lacks it, for `remove`) is skipped with `name_unchanged`.
1807
+ * Move a Google campaign's target CPA or target ROAS inside the strategy it is on (Target CPA or Maximize conversions for `cpa`, Target ROAS or Maximize conversion value for `roas`), never switching strategies. Campaign rules on Google only. Skipped with `portfolio_bid_strategy` on a portfolio strategy, `unsupported_bid_strategy` on one with no target (Manual CPC, Maximize clicks), and `no_target_cpa` or `no_target_roas` when the strategy holds no such target. A target CPA in a zero-decimal currency is rounded to whole units.
1808
+ */
1809
+ type: 'adjust_target';
1810
+ /**
1811
+ * Which target moves: `cpa` in the ad account currency, `roas` as a ratio (3 is 300%).
1812
+ */
1813
+ target: 'cpa' | 'roas';
1814
+ /**
1815
+ * The target to set.
1816
+ */
1817
+ amount?: number;
1818
+ direction?: 'increase' | 'decrease';
1819
+ /**
1820
+ * Step size. A decrease is at most 90.
1821
+ */
1822
+ percent?: number;
1823
+ /**
1824
+ * The target never goes above this on an increase, or below it on a decrease.
1825
+ */
1826
+ limit?: number;
1827
+ /**
1828
+ * At most this many objects changed in any 24 hours, across runs. Matches over the limit are skipped with `daily_limit_reached` and tried again later.
1829
+ */
1830
+ maxChangesPerDay?: number;
1831
+ /**
1832
+ * At most this many changes to one object by this rule, counted over the last 400 days. An object at the limit is left alone like one in cooldown.
1833
+ */
1834
+ maxChangesPerObject?: number;
1835
+ } | {
1836
+ /**
1837
+ * Move daily budget from the matched objects ranked worst by `metric` to those ranked best, keeping the total the same. Campaign or ad set rules where the budget sits at that level: objects whose budget sits at another level (Meta CBO and ad set budgets), Google shared budgets and lifetime budgets are left out. Changes are reserved all at once: when `maxChangesPerDay` would hold back any of them, none is made. A receiver is raised only after every giver's cut applied (else it fails with `reallocation_incomplete` and the move is tried again next run). Amounts move in the currency's smallest unit (whole units for JPY or KRW). Counts as raising live spend for the free ads allowance. Not with `lifecycle` or `groups`.
1838
+ */
1839
+ type: 'reallocate_budget';
1840
+ /**
1841
+ * What objects are ranked by: any condition metric except `day_of_month` and `working_day_of_month`, or a result metric (`result:<key>`) on campaign rules. Objects without a value are not ranked, except one that spent with no result on a metric where lower is best (a CPA with no conversions): it ranks worst and only gives.
1842
+ */
1843
+ metric: string;
1844
+ /**
1845
+ * The period the metric is read over, like a condition window.
1846
+ */
1847
+ window: string;
1848
+ /**
1849
+ * Which end of the ranking is best. Defaults to `lowest` for `cpa`, `cpc`, `cpm`, `frequency` and result metrics whose formula has spend above the line (cost per sale, %CAC), `highest` otherwise.
1850
+ */
1851
+ best?: 'highest' | 'lowest';
1852
+ /**
1853
+ * How many of the worst-ranked objects give budget.
1854
+ */
1855
+ from: {
1856
+ count: number;
1857
+ };
1858
+ /**
1859
+ * How many of the best-ranked objects receive it. With fewer ranked objects than `from` plus `to`, givers take at most half and no object is on both sides.
1860
+ */
1861
+ to: {
1862
+ count: number;
1863
+ };
1864
+ /**
1865
+ * The share of each giver's daily budget it gives.
1866
+ */
1867
+ percent?: number;
1868
+ /**
1869
+ * The total to move each run, in the ad account currency, taken evenly from the givers.
1870
+ */
1871
+ amount?: number;
1872
+ /**
1873
+ * A giver never goes below this daily budget. A giver also always keeps a tenth of its budget.
1874
+ */
1875
+ minBudget?: number;
1876
+ /**
1877
+ * A receiver never goes above this daily budget; what receivers cannot take stays with the givers.
1878
+ */
1879
+ maxBudget?: number;
1880
+ /**
1881
+ * At most this many objects changed in any 24 hours, across runs. Matches over the limit are skipped with `daily_limit_reached` and tried again later.
1882
+ */
1883
+ maxChangesPerDay?: number;
1884
+ /**
1885
+ * At most this many changes to one object by this rule, counted over the last 400 days. An object at the limit is left alone like one in cooldown.
1886
+ */
1887
+ maxChangesPerObject?: number;
1888
+ } | {
1889
+ /**
1890
+ * Tag the object by its name. Meta, TikTok and Reddit campaigns, ad sets and ads, and Google, LinkedIn and Pinterest campaigns and ad sets. An object whose name already has the tag (or lacks it, for `remove`) is skipped with `name_unchanged`.
1808
1891
  */
1809
1892
  type: 'edit_name';
1810
1893
  /**
@@ -1875,13 +1958,23 @@ export type type2 = 'notify';
1875
1958
 
1876
1959
  export type direction = 'increase' | 'decrease';
1877
1960
 
1961
+ /**
1962
+ * Which target moves: `cpa` in the ad account currency, `roas` as a ratio (3 is 300%).
1963
+ */
1964
+ export type target = 'cpa' | 'roas';
1965
+
1966
+ /**
1967
+ * Which end of the ranking is best. Defaults to `lowest` for `cpa`, `cpc`, `cpm`, `frequency` and result metrics whose formula has spend above the line (cost per sale, %CAC), `highest` otherwise.
1968
+ */
1969
+ export type best = 'highest' | 'lowest';
1970
+
1878
1971
  /**
1879
1972
  * Where `add` goes. Defaults to `start`.
1880
1973
  */
1881
1974
  export type at = 'start' | 'end';
1882
1975
 
1883
1976
  /**
1884
- * Each type at most once, and at most one of `pause`, `activate`, `adjust_budget`, `adjust_bid`, `duplicate` and `edit_name`.
1977
+ * Each type at most once, and at most one of `pause`, `activate`, `adjust_budget`, `adjust_bid`, `adjust_target`, `reallocate_budget`, `duplicate` and `edit_name`.
1885
1978
  */
1886
1979
  export type AdRuleActions = Array<AdRuleAction>;
1887
1980
 
@@ -1911,7 +2004,7 @@ export type AdRuleActivityEntry = {
1911
2004
  * Its name when the rule acted.
1912
2005
  */
1913
2006
  objectName: (string) | null;
1914
- type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'duplicate' | 'edit_name';
2007
+ type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'adjust_target' | 'reallocate_budget' | 'duplicate' | 'edit_name';
1915
2008
  status: 'done' | 'skipped' | 'failed';
1916
2009
  /**
1917
2010
  * Why it was skipped or failed, for example `already_paused`.
@@ -1935,15 +2028,32 @@ export type AdRuleActivityEntry = {
1935
2028
  * The cap an applied `adjust_bid` set.
1936
2029
  */
1937
2030
  newBidAmount: (number) | null;
2031
+ /**
2032
+ * Which target an `adjust_target` moved.
2033
+ */
2034
+ targetMetric: ('cpa' | 'roas') | null;
2035
+ /**
2036
+ * The target CPA or target ROAS before an `adjust_target`.
2037
+ */
2038
+ previousTarget: (number) | null;
2039
+ /**
2040
+ * The target an applied `adjust_target` set.
2041
+ */
2042
+ newTarget: (number) | null;
1938
2043
  currency: (string) | null;
1939
2044
  };
1940
2045
 
1941
2046
  export type level = 'campaign' | 'adset';
1942
2047
 
1943
- export type type3 = 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'duplicate' | 'edit_name';
2048
+ export type type3 = 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'adjust_target' | 'reallocate_budget' | 'duplicate' | 'edit_name';
1944
2049
 
1945
2050
  export type status3 = 'done' | 'skipped' | 'failed';
1946
2051
 
2052
+ /**
2053
+ * Which target an `adjust_target` moved.
2054
+ */
2055
+ export type targetMetric = 'cpa' | 'roas';
2056
+
1947
2057
  export type AdRuleCondition = {
1948
2058
  /**
1949
2059
  * `ctr` is a percentage. `spend`, `cpc`, `cpm` and `cpa` are in the ad account currency. `reach` and `frequency` use the platform's de-duplicated reach, so they are accepted on Meta and TikTok only.
@@ -2168,7 +2278,7 @@ export type AdRuleRun = {
2168
2278
  matched?: Array<AdRuleObjectEvaluation>;
2169
2279
  actions?: Array<{
2170
2280
  objectId: string;
2171
- type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'duplicate' | 'edit_name';
2281
+ type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'adjust_target' | 'reallocate_budget' | 'duplicate' | 'edit_name';
2172
2282
  status: 'done' | 'skipped' | 'failed';
2173
2283
  /**
2174
2284
  * Why it was skipped or failed, for example `already_paused`.
@@ -2180,6 +2290,9 @@ export type AdRuleRun = {
2180
2290
  newName?: string;
2181
2291
  previousBidAmount?: number;
2182
2292
  newBidAmount?: number;
2293
+ targetMetric?: 'cpa' | 'roas';
2294
+ previousTarget?: number;
2295
+ newTarget?: number;
2183
2296
  }>;
2184
2297
  /**
2185
2298
  * Set when a run of a rule with a `notify` action matched objects and tried to send the webhook. A notify-only rule whose webhook fails ends with outcome `failed`.
@@ -6605,6 +6718,19 @@ export type ConversionEvent = {
6605
6718
  * URL where the conversion originated (used by Meta).
6606
6719
  */
6607
6720
  sourceUrl?: string;
6721
+ /**
6722
+ * The ad campaign behind the event, when you know it. Read only by `POST /v1/events`, which ties the event to the campaign named by `campaign.id`, then by the `utm_campaign` of `sourceUrl`, then by `campaign.name`. See its Storage notes for how the event then counts.
6723
+ */
6724
+ campaign?: {
6725
+ /**
6726
+ * Platform campaign ID.
6727
+ */
6728
+ id?: string;
6729
+ /**
6730
+ * Campaign name as it appears on the ad platform (case-insensitive).
6731
+ */
6732
+ name?: string;
6733
+ };
6608
6734
  /**
6609
6735
  * Where the conversion happened. Used by Meta. Google also requires an event source internally; omitting this field sends OTHER to Google. Send an explicit value for accurate origin reporting. `business_messaging` (Meta) marks an event from a WhatsApp, Messenger or Instagram Direct conversation and needs `messaging`.
6610
6736
  */
@@ -18081,7 +18207,7 @@ export type WebhookPayloadAdRuleTriggered = {
18081
18207
  * What the rule did to the object. Empty on a rule that only notifies.
18082
18208
  */
18083
18209
  actions: Array<{
18084
- type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'duplicate' | 'edit_name';
18210
+ type: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'adjust_target' | 'reallocate_budget' | 'duplicate' | 'edit_name';
18085
18211
  /**
18086
18212
  * Action result.
18087
18213
  *
@@ -18090,7 +18216,7 @@ export type WebhookPayloadAdRuleTriggered = {
18090
18216
  */
18091
18217
  status: 'done' | 'skipped' | 'failed';
18092
18218
  /**
18093
- * Why the action was skipped or failed: `already_paused`, `already_active`, `at_limit`, `budget_unknown`, `budget_not_daily`, `budget_level_mismatch`, `no_live_ads`, `daily_limit_reached` (held back by the action's `maxChangesPerDay`), `ads_allowance_exceeded` (a reactivation or budget increase for a team past its free live-ads allowance), or the platform's message. Null when done.
18219
+ * Why the action was skipped or failed: `already_paused`, `already_active`, `at_limit`, `budget_unknown`, `budget_not_daily`, `budget_level_mismatch`, `no_live_ads`, `daily_limit_reached` (held back by the action's `maxChangesPerDay`), `ads_allowance_exceeded` (a reactivation or budget increase for a team past its free live-ads allowance), `budget_shared`, `reallocation_incomplete` (failed: a receiver left alone because a giver's cut did not apply, tried again next run), `portfolio_bid_strategy`, `unsupported_bid_strategy`, `no_target_cpa`, `no_target_roas`, or the platform's message. Null when done.
18094
18220
  */
18095
18221
  reason: (string) | null;
18096
18222
  /**
@@ -18117,6 +18243,18 @@ export type WebhookPayloadAdRuleTriggered = {
18117
18243
  * On `adjust_bid`, the cap after the change. Null when nothing changed.
18118
18244
  */
18119
18245
  newBidAmount: (number) | null;
18246
+ /**
18247
+ * On `adjust_target`, which target moved. Null otherwise.
18248
+ */
18249
+ targetMetric: ('cpa' | 'roas') | null;
18250
+ /**
18251
+ * On `adjust_target`, the target before the change. Null otherwise.
18252
+ */
18253
+ previousTarget: (number) | null;
18254
+ /**
18255
+ * On `adjust_target`, the target after the change. Null when nothing changed.
18256
+ */
18257
+ newTarget: (number) | null;
18120
18258
  }>;
18121
18259
  }>;
18122
18260
  /**
@@ -52546,7 +52684,7 @@ export type ListAdRuleActivityData = {
52546
52684
  * ISO 8601 date-time, inclusive.
52547
52685
  */
52548
52686
  to?: string;
52549
- type?: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'duplicate' | 'edit_name';
52687
+ type?: 'pause' | 'activate' | 'adjust_budget' | 'adjust_bid' | 'adjust_target' | 'reallocate_budget' | 'duplicate' | 'edit_name';
52550
52688
  };
52551
52689
  };
52552
52690