@koda-sl/baker-cli 0.151.0 → 0.152.0
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/README.md +8 -0
- package/dist/cli.js +157 -2
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -858,6 +858,7 @@ audit --format md # deliverable-ready markdown table
|
|
|
858
858
|
|
|
859
859
|
campaign-groups create|update|pause|resume|duplicate # staged writes (see below)
|
|
860
860
|
campaigns create|update|pause|resume|archive|duplicate
|
|
861
|
+
campaigns url-params <ad-set-id> # UTMs for every ad in the ad set
|
|
861
862
|
creatives create|update|pause|resume|duplicate
|
|
862
863
|
audiences create|upload
|
|
863
864
|
conversions create|update
|
|
@@ -880,6 +881,12 @@ baker ads linkedin campaigns create --name "ABM Tier-1" --group li_temp_x1 \
|
|
|
880
881
|
baker ads linkedin creatives create --campaign li_temp_x2 --format image \
|
|
881
882
|
--image-id <bakerImageId> --headline "Book a demo" --landing-url https://example.com/demo --cta REQUEST_DEMO
|
|
882
883
|
|
|
884
|
+
# UTMs belong on the ad set — LinkedIn appends them to every ad in it, live ones included
|
|
885
|
+
baker ads linkedin campaigns url-params 123456 \
|
|
886
|
+
--param "utm_source=linkedin&utm_medium=paid-social" \
|
|
887
|
+
--dynamic utm_campaign=CAMPAIGN_NAME --dynamic utm_content=CREATIVE_ID
|
|
888
|
+
baker ads linkedin campaigns url-params 123456 --clear # remove them all
|
|
889
|
+
|
|
883
890
|
# Fix the classic audit findings
|
|
884
891
|
baker ads linkedin campaigns update 123456 --audience-expansion off --lan off
|
|
885
892
|
baker ads linkedin campaigns update 123456 --bid 7.50 --daily-budget 100 --currency USD
|
|
@@ -4731,6 +4738,7 @@ This CLI is designed for AI agent consumption. Key patterns:
|
|
|
4731
4738
|
- **0.121.0**: `lead-forms create` drops the `privacyPolicyText` field — LinkedIn's versioned lead-form API has no privacy-policy-text slot, so it was silently discarded on publish. Use `legalDisclaimer` (shown under the form) or `consents[]` (disclosure checkboxes) instead. (Companion backend fix: staged lead-form questions were serialized in a shape LinkedIn dropped — they now publish correctly, and the staged preview lists each question.)
|
|
4732
4739
|
- **0.119.0**: `draft amend`/`draft show` land on both `baker ads google` and `baker ads linkedin` — a generic JSON-merge-patch to update any staged op in place plus a full-payload receipt, replacing remove+recreate as the correction path. Google gains `assets update` and `asset-groups create|update` (Performance Max asset groups are now their own entity — `ads create --format performanceMaxAssetGroup` never worked and is gone); `ads create --format video` moves from a bare YouTube id to `--video-assets` refs (**breaking flag change** — stage the video as an asset first); `--format demandGen` gains `--image-assets`/`--square-image-assets`/`--logo-image-assets` and flag-building for headlines/descriptions. LinkedIn's `draft list` now renders a readable Campaign group ▸ Campaign ▸ Creative tree by default (`--json` for raw), `creatives update` gains `--campaign` (re-parent while staged), and `campaigns update` passes create-only fields (`--group`/`--type`/`--locale`/`--associated-entity`) through when amending a `li_temp_*` staged create instead of always stripping them.
|
|
4733
4740
|
- **0.150.0**: `baker landing critique` gains an `agent-washing` rule in the `copy` family — an autonomy claim ("fully autonomous", "while you sleep", "no human intervention") with no signal anywhere on the page about who oversees the agent (approval, review, override, undo/rollback, audit log, escalation) scores a warn. Page-scope, so a hero may defer the trust story to a later section; generic privacy boilerplate does not clear it. `CRITIC_VERSION` bumps to `2`.
|
|
4741
|
+
- **0.152.0**: `baker ads linkedin campaigns url-params <ad-set-id>` stages an ad set's URL tracking parameters (LinkedIn's `adTrackingParameters`) — `--param key=value` for fixed values (repeatable or `&`-joined), `--dynamic key=PLACEHOLDER` for values LinkedIn fills in per ad (`CAMPAIGN_NAME`, `CREATIVE_ID`, …), `--clear` to remove them. LinkedIn appends these to the landing URL of every ad in the ad set, including ads already running, so this replaces stamping the same UTM onto each ad's `--landing-url` — which missed later ads and double-appended keys the ad set already set. Account-level parameters remain UI-only (LinkedIn exposes no API for them).
|
|
4734
4742
|
|
|
4735
4743
|
## Publishing
|
|
4736
4744
|
|
package/dist/cli.js
CHANGED
|
@@ -1297,6 +1297,15 @@ var LINKEDIN_LIMITS = {
|
|
|
1297
1297
|
campaign: {
|
|
1298
1298
|
nameMax: 255
|
|
1299
1299
|
},
|
|
1300
|
+
/**
|
|
1301
|
+
* LinkedIn documents no ceiling on URL tracking parameters; these are our own
|
|
1302
|
+
* guards against a payload that would build an unusable landing URL.
|
|
1303
|
+
*/
|
|
1304
|
+
trackingParams: {
|
|
1305
|
+
keyMax: 100,
|
|
1306
|
+
valueMax: 500,
|
|
1307
|
+
parametersMax: 20
|
|
1308
|
+
},
|
|
1300
1309
|
creative: {
|
|
1301
1310
|
commentarySoftMax: 600,
|
|
1302
1311
|
// feed truncates with "…see more" beyond this
|
|
@@ -1435,6 +1444,17 @@ var CONVERSION_TYPES = [
|
|
|
1435
1444
|
];
|
|
1436
1445
|
var CONVERSION_METHODS = ["INSIGHT_TAG", "CONVERSIONS_API"];
|
|
1437
1446
|
var ATTRIBUTION_TYPES = ["LAST_TOUCH_BY_CAMPAIGN", "LAST_TOUCH_BY_CONVERSION"];
|
|
1447
|
+
var TRACKING_PARAM_DYNAMIC_VALUES = [
|
|
1448
|
+
"ACCOUNT_ID",
|
|
1449
|
+
"ACCOUNT_NAME",
|
|
1450
|
+
"CAMPAIGN_GROUP_ID",
|
|
1451
|
+
"CAMPAIGN_GROUP_NAME",
|
|
1452
|
+
"CAMPAIGN_ID",
|
|
1453
|
+
"CAMPAIGN_NAME",
|
|
1454
|
+
"CREATIVE_ID",
|
|
1455
|
+
"CREATIVE_NAME"
|
|
1456
|
+
];
|
|
1457
|
+
var TRACKING_PARAM_KEY_REGEX = /^[A-Za-z0-9_.-]+$/;
|
|
1438
1458
|
var CURRENCY_MINIMUMS = {
|
|
1439
1459
|
USD: { dailyBudgetMin: 10, unitCostMin: 2 },
|
|
1440
1460
|
EUR: { dailyBudgetMin: 10, unitCostMin: 2 },
|
|
@@ -1592,6 +1612,35 @@ var campaignUpdateSchema = z3.object({
|
|
|
1592
1612
|
}
|
|
1593
1613
|
validateCampaignBudgets(p, ctx, { requireBudget: false });
|
|
1594
1614
|
});
|
|
1615
|
+
var trackingParamKeySchema = z3.string().min(1).max(LINKEDIN_LIMITS.trackingParams.keyMax).regex(TRACKING_PARAM_KEY_REGEX, "tracking parameter keys may only use letters, digits, _ . and -");
|
|
1616
|
+
var trackingParamsSetSchema = z3.object({
|
|
1617
|
+
dynamicValueParameters: z3.record(trackingParamKeySchema, z3.enum(TRACKING_PARAM_DYNAMIC_VALUES)).optional(),
|
|
1618
|
+
customValueParameters: z3.record(trackingParamKeySchema, z3.string().min(1).max(LINKEDIN_LIMITS.trackingParams.valueMax)).optional()
|
|
1619
|
+
}).superRefine((p, ctx) => {
|
|
1620
|
+
if (!p.dynamicValueParameters && !p.customValueParameters) {
|
|
1621
|
+
ctx.addIssue({
|
|
1622
|
+
code: "custom",
|
|
1623
|
+
message: "set at least one parameter \u2014 pass --param key=value or --dynamic key=PLACEHOLDER, or --clear (both maps as {}) to remove the ad set's tracking parameters"
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
const both = Object.keys(p.dynamicValueParameters ?? {}).filter(
|
|
1627
|
+
(key) => p.customValueParameters?.[key] !== void 0
|
|
1628
|
+
);
|
|
1629
|
+
if (both.length > 0) {
|
|
1630
|
+
ctx.addIssue({
|
|
1631
|
+
code: "custom",
|
|
1632
|
+
path: ["customValueParameters"],
|
|
1633
|
+
message: `${both.join(", ")} is set as both a dynamic and a fixed parameter \u2014 LinkedIn appends each key once, so keep only one`
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
const count = Object.keys(p.dynamicValueParameters ?? {}).length + Object.keys(p.customValueParameters ?? {}).length;
|
|
1637
|
+
if (count > LINKEDIN_LIMITS.trackingParams.parametersMax) {
|
|
1638
|
+
ctx.addIssue({
|
|
1639
|
+
code: "custom",
|
|
1640
|
+
message: `${count} parameters \u2014 keep it under ${LINKEDIN_LIMITS.trackingParams.parametersMax}`
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1595
1644
|
var commentarySchema = z3.string().min(1).max(LINKEDIN_LIMITS.creative.commentaryHardMax);
|
|
1596
1645
|
var headlineSchema = z3.string().min(1).max(LINKEDIN_LIMITS.creative.headlineMax);
|
|
1597
1646
|
var httpsUrlSchema = z3.string().url().refine((u) => u.startsWith("https://"), "landing pages must be https");
|
|
@@ -1970,6 +2019,7 @@ var LINKEDIN_DRAFT_OP_KINDS = [
|
|
|
1970
2019
|
"campaignGroup.update",
|
|
1971
2020
|
"campaign.create",
|
|
1972
2021
|
"campaign.update",
|
|
2022
|
+
"trackingParams.set",
|
|
1973
2023
|
"creative.create",
|
|
1974
2024
|
"creative.update",
|
|
1975
2025
|
"audience.create",
|
|
@@ -1993,6 +2043,7 @@ var linkedinDraftOpInputSchema = z3.discriminatedUnion("kind", [
|
|
|
1993
2043
|
updateOp("campaignGroup.update", campaignGroupUpdateSchema),
|
|
1994
2044
|
createOp("campaign.create", campaignCreateSchema),
|
|
1995
2045
|
updateOp("campaign.update", campaignUpdateSchema),
|
|
2046
|
+
updateOp("trackingParams.set", trackingParamsSetSchema),
|
|
1996
2047
|
createOp("creative.create", creativeCreateSchema),
|
|
1997
2048
|
updateOp("creative.update", creativeUpdateSchema),
|
|
1998
2049
|
createOp("audience.create", audienceCreateSchema),
|
|
@@ -8490,6 +8541,26 @@ registerSchema({
|
|
|
8490
8541
|
file: { type: "string", description: "JSON file with fields to change", required: false }
|
|
8491
8542
|
}
|
|
8492
8543
|
});
|
|
8544
|
+
registerSchema({
|
|
8545
|
+
command: "ads.linkedin.campaigns.url-params",
|
|
8546
|
+
description: "Start here for UTMs: stage the URL tracking parameters on an ad set. LinkedIn appends them to the link of EVERY ad in the ad set, including ads already running, so this is the level to set campaign-wide UTMs at \u2014 editing each ad's landing URL instead risks the same key landing twice. --param takes fixed values (repeatable or &-joined); --dynamic takes a value LinkedIn fills in per ad (ACCOUNT_ID, ACCOUNT_NAME, CAMPAIGN_GROUP_ID, CAMPAIGN_GROUP_NAME, CAMPAIGN_ID, CAMPAIGN_NAME, CREATIVE_ID, CREATIVE_NAME). Applies on chat publish; message and conversation ads are unaffected.",
|
|
8547
|
+
args: {
|
|
8548
|
+
id: { type: "positional", description: "Ad set (campaign) id or URN", required: true },
|
|
8549
|
+
...writeAccountArgs,
|
|
8550
|
+
param: {
|
|
8551
|
+
type: "string",
|
|
8552
|
+
description: 'Fixed key=value, repeatable or &-joined \u2014 e.g. "utm_source=linkedin&utm_medium=paid-social"',
|
|
8553
|
+
required: false
|
|
8554
|
+
},
|
|
8555
|
+
dynamic: {
|
|
8556
|
+
type: "string",
|
|
8557
|
+
description: "key=PLACEHOLDER filled in per ad, repeatable \u2014 e.g. utm_campaign=CAMPAIGN_NAME",
|
|
8558
|
+
required: false
|
|
8559
|
+
},
|
|
8560
|
+
clear: { type: "boolean", description: "Remove every tracking parameter from this ad set", required: false },
|
|
8561
|
+
file: { type: "string", description: "JSON payload file; flags override file keys", required: false }
|
|
8562
|
+
}
|
|
8563
|
+
});
|
|
8493
8564
|
var statusSugarArgs = {
|
|
8494
8565
|
id: { type: "positional", description: "Entity id or URN", required: true },
|
|
8495
8566
|
...writeAccountArgs
|
|
@@ -10014,6 +10085,88 @@ Example: baker ads linkedin ${entity} ${name} 123456`
|
|
|
10014
10085
|
}
|
|
10015
10086
|
});
|
|
10016
10087
|
}
|
|
10088
|
+
function trackingPairs(value, flag) {
|
|
10089
|
+
const raw = value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
10090
|
+
return raw.flatMap(
|
|
10091
|
+
(entry) => String(entry).split("&").filter((pair) => pair.length > 0).map((pair) => {
|
|
10092
|
+
const at = pair.indexOf("=");
|
|
10093
|
+
if (at < 1 || at === pair.length - 1) {
|
|
10094
|
+
failWriteValidation2(`${flag} expects key=value pairs \u2014 got "${pair}"`);
|
|
10095
|
+
}
|
|
10096
|
+
return [pair.slice(0, at).trim(), pair.slice(at + 1).trim()];
|
|
10097
|
+
})
|
|
10098
|
+
);
|
|
10099
|
+
}
|
|
10100
|
+
function asDynamicValue(value) {
|
|
10101
|
+
const bare = value.replace(/^\{+|\}+$/g, "").toUpperCase();
|
|
10102
|
+
return TRACKING_PARAM_DYNAMIC_VALUES.includes(bare) ? bare : void 0;
|
|
10103
|
+
}
|
|
10104
|
+
function trackingParamsPayload(args) {
|
|
10105
|
+
if (args.clear) {
|
|
10106
|
+
return { dynamicValueParameters: {}, customValueParameters: {} };
|
|
10107
|
+
}
|
|
10108
|
+
const customValueParameters = {};
|
|
10109
|
+
for (const [key, value] of trackingPairs(args.param, "--param")) {
|
|
10110
|
+
if (asDynamicValue(value)) {
|
|
10111
|
+
failWriteValidation2(
|
|
10112
|
+
`--param ${key}=${value} names a value LinkedIn fills in per ad \u2014 pass it as --dynamic ${key}=${value.replace(/^\{+|\}+$/g, "").toUpperCase()}`
|
|
10113
|
+
);
|
|
10114
|
+
}
|
|
10115
|
+
customValueParameters[key] = value;
|
|
10116
|
+
}
|
|
10117
|
+
const dynamicValueParameters = {};
|
|
10118
|
+
for (const [key, value] of trackingPairs(args.dynamic, "--dynamic")) {
|
|
10119
|
+
const resolved = asDynamicValue(value);
|
|
10120
|
+
if (!resolved) {
|
|
10121
|
+
failWriteValidation2(
|
|
10122
|
+
`--dynamic ${key}=${value} is not a value LinkedIn can fill in \u2014 use one of ${TRACKING_PARAM_DYNAMIC_VALUES.join(", ")}, or pass a fixed value with --param`
|
|
10123
|
+
);
|
|
10124
|
+
}
|
|
10125
|
+
dynamicValueParameters[key] = resolved;
|
|
10126
|
+
}
|
|
10127
|
+
return mergePayload2(loadJsonFileArg2(args.file), {
|
|
10128
|
+
customValueParameters: Object.keys(customValueParameters).length > 0 ? customValueParameters : void 0,
|
|
10129
|
+
dynamicValueParameters: Object.keys(dynamicValueParameters).length > 0 ? dynamicValueParameters : void 0
|
|
10130
|
+
});
|
|
10131
|
+
}
|
|
10132
|
+
var campaignsUrlParamsCommand = defineCommand37({
|
|
10133
|
+
meta: {
|
|
10134
|
+
name: "url-params",
|
|
10135
|
+
description: `Stage the URL tracking parameters on an ad set \u2014 LinkedIn appends them to the link of EVERY ad in it, including ads already running. ${STAGED_NOTE}
|
|
10136
|
+
|
|
10137
|
+
Start here: set UTMs at this level, not per ad. A per-ad landing URL is only for a genuinely different destination \u2014 LinkedIn appends the ad set's parameters on top of whatever the ad's own URL carries, so the same key set in both places lands twice.
|
|
10138
|
+
|
|
10139
|
+
Values LinkedIn fills in per ad (--dynamic): ACCOUNT_ID, ACCOUNT_NAME, CAMPAIGN_GROUP_ID, CAMPAIGN_GROUP_NAME, CAMPAIGN_ID, CAMPAIGN_NAME, CREATIVE_ID, CREATIVE_NAME.
|
|
10140
|
+
|
|
10141
|
+
Examples:
|
|
10142
|
+
baker ads linkedin campaigns url-params 123456 --param "utm_source=linkedin&utm_medium=paid-social" --dynamic utm_campaign=CAMPAIGN_NAME --dynamic utm_content=CREATIVE_ID
|
|
10143
|
+
baker ads linkedin campaigns url-params 123456 --param utm_agency=baker
|
|
10144
|
+
baker ads linkedin campaigns url-params 123456 --clear`
|
|
10145
|
+
},
|
|
10146
|
+
args: {
|
|
10147
|
+
id: { type: "positional", description: "Ad set (campaign) id or URN", required: true },
|
|
10148
|
+
...accountArgs,
|
|
10149
|
+
param: {
|
|
10150
|
+
type: "string",
|
|
10151
|
+
description: 'Fixed key=value, repeatable or &-joined (e.g. --param "utm_source=linkedin&utm_medium=paid")'
|
|
10152
|
+
},
|
|
10153
|
+
dynamic: {
|
|
10154
|
+
type: "string",
|
|
10155
|
+
description: "key=PLACEHOLDER LinkedIn fills in per ad, repeatable (e.g. --dynamic utm_campaign=CAMPAIGN_NAME)"
|
|
10156
|
+
},
|
|
10157
|
+
clear: { type: "boolean", description: "Remove every tracking parameter from this ad set" },
|
|
10158
|
+
file: { type: "string", description: "JSON file with the full payload; flags override file keys" }
|
|
10159
|
+
},
|
|
10160
|
+
run: async ({ args }) => {
|
|
10161
|
+
const accountId = bareAccountId(args);
|
|
10162
|
+
await stageOp({
|
|
10163
|
+
kind: "trackingParams.set",
|
|
10164
|
+
accountId,
|
|
10165
|
+
target: requireTarget2(args, "ad set"),
|
|
10166
|
+
payload: trackingParamsPayload(args)
|
|
10167
|
+
});
|
|
10168
|
+
}
|
|
10169
|
+
});
|
|
10017
10170
|
var campaignsPauseCommand = statusSugarCommand("campaigns", "campaign.update", "pause");
|
|
10018
10171
|
var campaignsResumeCommand = statusSugarCommand("campaigns", "campaign.update", "resume");
|
|
10019
10172
|
var campaignsArchiveCommand = statusSugarCommand("campaigns", "campaign.update", "archive");
|
|
@@ -10546,7 +10699,8 @@ Examples:
|
|
|
10546
10699
|
baker ads linkedin campaigns --account-id 503001492
|
|
10547
10700
|
baker ads linkedin campaigns --account-id 503001492 --all-statuses --output csv
|
|
10548
10701
|
baker ads linkedin campaigns update 123456 --daily-budget 100 --currency EUR
|
|
10549
|
-
baker ads linkedin campaigns pause 123456
|
|
10702
|
+
baker ads linkedin campaigns pause 123456
|
|
10703
|
+
baker ads linkedin campaigns url-params 123456 --param utm_source=linkedin \u2014 UTMs for every ad in the ad set`
|
|
10550
10704
|
},
|
|
10551
10705
|
subCommands: {
|
|
10552
10706
|
create: campaignsCreateCommand,
|
|
@@ -10554,7 +10708,8 @@ Examples:
|
|
|
10554
10708
|
pause: campaignsPauseCommand,
|
|
10555
10709
|
resume: campaignsResumeCommand,
|
|
10556
10710
|
archive: campaignsArchiveCommand,
|
|
10557
|
-
duplicate: campaignsDuplicateCommand
|
|
10711
|
+
duplicate: campaignsDuplicateCommand,
|
|
10712
|
+
"url-params": campaignsUrlParamsCommand
|
|
10558
10713
|
},
|
|
10559
10714
|
args: {
|
|
10560
10715
|
"account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
|