@adkit/cli 1.13.29 → 1.13.30
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/cli.js +187 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1567,6 +1567,15 @@ async function listMetaLeadForms(client, _args, flags) {
|
|
|
1567
1567
|
const qs = queryString({ accountId, pageId, fields, raw });
|
|
1568
1568
|
return client.get(`/manage/meta/lead-forms${qs}`);
|
|
1569
1569
|
}
|
|
1570
|
+
async function listMetaConversions(client, _args, flags) {
|
|
1571
|
+
validateFlags(flags, ["account", "limit", "offset", "raw"], "manage meta conversions list");
|
|
1572
|
+
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
1573
|
+
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
1574
|
+
const offset = typeof flags.offset === "string" ? flags.offset : void 0;
|
|
1575
|
+
const raw = flags.raw === true ? "true" : void 0;
|
|
1576
|
+
const qs = queryString({ accountId, limit, offset, raw });
|
|
1577
|
+
return client.get(`/manage/meta/conversions${qs}`);
|
|
1578
|
+
}
|
|
1570
1579
|
function buildCampaignPayload(flags) {
|
|
1571
1580
|
const payload = {};
|
|
1572
1581
|
if (typeof flags.name === "string") payload.name = flags.name;
|
|
@@ -2024,6 +2033,9 @@ var SEARCH_TERMS_FLAGS = ["campaign", "ad-group", "keyword", "keyword-match-type
|
|
|
2024
2033
|
var PLACEMENT_REPORT_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "raw"];
|
|
2025
2034
|
var GOOGLE_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "breakdown", "fields", "conversion-actions", "raw"];
|
|
2026
2035
|
var GOOGLE_KEYWORD_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "fields", "raw"];
|
|
2036
|
+
var CONVERSION_LIST_FLAGS = ["limit", "offset"];
|
|
2037
|
+
var CONVERSION_CREATE_FLAGS = ["name", "type", "category", "status", "counting-type", "default-value", "currency", "click-days", "view-days"];
|
|
2038
|
+
var CONVERSION_UPDATE_FLAGS = ["name", "category", "counting-type", "default-value", "currency"];
|
|
2027
2039
|
var CONVERSION_UPLOAD_FLAGS = ["conversion", "gclid", "gbraid", "wbraid", "occurred-at", "value", "currency", "order-id", "conversion-environment", "validate-only", "job-id"];
|
|
2028
2040
|
var CHANGE_HISTORY_FLAGS = ["account", "period", "from", "to", "limit", "resource", "campaign", "ad-group"];
|
|
2029
2041
|
var KEYWORD_RESEARCH_FLAGS = ["url", "location", "language", "limit", "min-volume"];
|
|
@@ -2250,6 +2262,40 @@ function applyGoogleClickConversionUploadOptions(body, flags) {
|
|
|
2250
2262
|
if (!Number.isInteger(jobId) || jobId >= 2147483648) throw new CliError("INVALID_VALUE", `Invalid integer for --job-id: ${rawJobId}`, "Use a non-negative integer below 2147483648");
|
|
2251
2263
|
body.jobId = jobId;
|
|
2252
2264
|
}
|
|
2265
|
+
function buildGoogleConversionCreateInput(flags) {
|
|
2266
|
+
const conversion = {
|
|
2267
|
+
name: requireFlag(flags, "name", "Google conversion create requires --name"),
|
|
2268
|
+
type: requireFlag(flags, "type", "Google conversion create requires --type"),
|
|
2269
|
+
category: requireFlag(flags, "category", "Google conversion create requires --category")
|
|
2270
|
+
};
|
|
2271
|
+
if (flags.status !== void 0) {
|
|
2272
|
+
if (flags.status !== "enabled") throw new CliError("INVALID_VALUE", `Unsupported conversion create status: ${String(flags.status)}`, "Use --status enabled or omit the flag.");
|
|
2273
|
+
conversion.status = flags.status;
|
|
2274
|
+
}
|
|
2275
|
+
if (typeof flags["counting-type"] === "string") conversion.countingType = flags["counting-type"];
|
|
2276
|
+
if (typeof flags["default-value"] === "string") conversion.defaultValue = readNumberFlag(flags, "default-value", "Use a non-negative number for --default-value");
|
|
2277
|
+
if (typeof flags.currency === "string") conversion.currency = flags.currency;
|
|
2278
|
+
const clickDays = readPositiveIntegerFlag(flags, "click-days");
|
|
2279
|
+
const viewDays = readPositiveIntegerFlag(flags, "view-days");
|
|
2280
|
+
if (clickDays !== void 0 || viewDays !== void 0) conversion.attributionWindow = { clickDays, viewDays };
|
|
2281
|
+
return conversion;
|
|
2282
|
+
}
|
|
2283
|
+
function buildGoogleConversionUpdateInput(flags) {
|
|
2284
|
+
const changes = {};
|
|
2285
|
+
if (typeof flags.name === "string") changes.name = flags.name;
|
|
2286
|
+
if (typeof flags.category === "string") changes.category = flags.category;
|
|
2287
|
+
if (typeof flags["counting-type"] === "string") changes.countingType = flags["counting-type"];
|
|
2288
|
+
if (typeof flags["default-value"] === "string") changes.defaultValue = readNumberFlag(flags, "default-value", "Use a non-negative number for --default-value");
|
|
2289
|
+
if (typeof flags.currency === "string") changes.currency = flags.currency;
|
|
2290
|
+
if (Object.keys(changes).length === 0) throw new CliError("MISSING_FLAG", "Conversion update requires at least one change", "Pass --name, --category, --counting-type, --default-value, --currency, or --data");
|
|
2291
|
+
return changes;
|
|
2292
|
+
}
|
|
2293
|
+
function readPositiveIntegerFlag(flags, key) {
|
|
2294
|
+
const value = flags[key];
|
|
2295
|
+
if (value === void 0) return void 0;
|
|
2296
|
+
if (typeof value !== "string" || !/^\d+$/u.test(value) || Number(value) < 1) throw new CliError("INVALID_VALUE", `Invalid positive integer for --${key}: ${String(value)}`, `Use a positive integer for --${key}`);
|
|
2297
|
+
return Number(value);
|
|
2298
|
+
}
|
|
2253
2299
|
function resolveAssetScope(flags) {
|
|
2254
2300
|
const scopeType = typeof flags.scope === "string" ? flags.scope : void 0;
|
|
2255
2301
|
if (scopeType !== "account" && scopeType !== "campaign" && scopeType !== "ad-group") throw new CliError("MISSING_FLAG", "Missing required flag: `--scope`", "Use --scope account|campaign|ad-group");
|
|
@@ -2616,6 +2662,57 @@ async function uploadGoogleConversions(client, _args, flags) {
|
|
|
2616
2662
|
const path3 = `/manage/google/conversions/upload${query}`;
|
|
2617
2663
|
return client.post(path3, body);
|
|
2618
2664
|
}
|
|
2665
|
+
async function listGoogleConversions(client, _args, flags) {
|
|
2666
|
+
validateFlags(flags, CONVERSION_LIST_FLAGS, "manage google conversions list");
|
|
2667
|
+
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
2668
|
+
const fields = typeof flags.fields === "string" ? flags.fields : void 0;
|
|
2669
|
+
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
2670
|
+
const offset = typeof flags.offset === "string" ? flags.offset : void 0;
|
|
2671
|
+
const query = queryString({ accountId, fields, limit, offset });
|
|
2672
|
+
return client.get(`/manage/google/conversions${query}`);
|
|
2673
|
+
}
|
|
2674
|
+
async function getGoogleConversion(client, args, flags) {
|
|
2675
|
+
validateFlags(flags, [], "manage google conversions get");
|
|
2676
|
+
const id = requireGoogleNumericId(args, "conversion-id", "Run: adkit manage google conversions get <conversion-id>");
|
|
2677
|
+
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
2678
|
+
const fields = typeof flags.fields === "string" ? flags.fields : void 0;
|
|
2679
|
+
const query = queryString({ accountId, fields });
|
|
2680
|
+
return client.get(`/manage/google/conversions/${id}${query}`);
|
|
2681
|
+
}
|
|
2682
|
+
async function createGoogleConversion(client, _args, flags) {
|
|
2683
|
+
validateFlags(flags, CONVERSION_CREATE_FLAGS, "manage google conversions create");
|
|
2684
|
+
if (typeof flags.data === "string") {
|
|
2685
|
+
const rawBody2 = parseDataFlag(flags, 'Use { "conversions": [...] } for Google conversion create');
|
|
2686
|
+
const query2 = buildGoogleMutationQuery(flags, rawBody2);
|
|
2687
|
+
const body2 = removeQueryOnlyBodyKeys(rawBody2, ["accountId"]);
|
|
2688
|
+
return client.post(`/manage/google/conversions${query2}`, body2);
|
|
2689
|
+
}
|
|
2690
|
+
const conversion = buildGoogleConversionCreateInput(flags);
|
|
2691
|
+
const rawBody = { conversions: [conversion] };
|
|
2692
|
+
const query = buildGoogleMutationQuery(flags, rawBody);
|
|
2693
|
+
const body = removeQueryOnlyBodyKeys(rawBody, ["accountId"]);
|
|
2694
|
+
return client.post(`/manage/google/conversions${query}`, body);
|
|
2695
|
+
}
|
|
2696
|
+
async function updateGoogleConversion(client, args, flags) {
|
|
2697
|
+
validateFlags(flags, CONVERSION_UPDATE_FLAGS, "manage google conversions update");
|
|
2698
|
+
const id = requireGoogleNumericId(args, "conversion-id", "Run: adkit manage google conversions update <conversion-id> --data <json>");
|
|
2699
|
+
if (typeof flags.data === "string") {
|
|
2700
|
+
const rawBody2 = parseDataFlag(flags, "Use a Google conversion update object");
|
|
2701
|
+
const query2 = buildGoogleMutationQuery(flags, rawBody2);
|
|
2702
|
+
const body2 = removeQueryOnlyBodyKeys(rawBody2, ["accountId"]);
|
|
2703
|
+
return client.patch(`/manage/google/conversions/${id}${query2}`, body2);
|
|
2704
|
+
}
|
|
2705
|
+
const rawBody = buildGoogleConversionUpdateInput(flags);
|
|
2706
|
+
const query = buildGoogleMutationQuery(flags, rawBody);
|
|
2707
|
+
const body = removeQueryOnlyBodyKeys(rawBody, ["accountId"]);
|
|
2708
|
+
return client.patch(`/manage/google/conversions/${id}${query}`, body);
|
|
2709
|
+
}
|
|
2710
|
+
async function deleteGoogleConversion(client, args, flags) {
|
|
2711
|
+
validateFlags(flags, [], "manage google conversions delete");
|
|
2712
|
+
const id = requireGoogleNumericId(args, "conversion-id", "Run: adkit manage google conversions delete <conversion-id>");
|
|
2713
|
+
const query = buildGoogleMutationQuery(flags, {});
|
|
2714
|
+
return client.delete(`/manage/google/conversions/${id}${query}`);
|
|
2715
|
+
}
|
|
2619
2716
|
async function listGoogleCampaigns(client, _args, flags) {
|
|
2620
2717
|
validateFlags(flags, CAMPAIGN_LIST_FLAGS, "manage google campaigns list");
|
|
2621
2718
|
const qs = buildGoogleListQuery(flags);
|
|
@@ -6441,8 +6538,43 @@ Notes:
|
|
|
6441
6538
|
YouTube registration does not upload, copy, or re-host the video.`;
|
|
6442
6539
|
var GOOGLE_CONVERSIONS_HELP = `adkit manage google conversions \u2014 Google Ads conversion tracking
|
|
6443
6540
|
|
|
6541
|
+
list List configured conversion actions
|
|
6542
|
+
get <id> View a conversion action
|
|
6543
|
+
create Create a conversion action
|
|
6544
|
+
update <id> Update a conversion action
|
|
6545
|
+
delete <id> Delete a conversion action
|
|
6444
6546
|
upload Upload offline click conversion events
|
|
6445
6547
|
|
|
6548
|
+
Flags (list/get):
|
|
6549
|
+
--account <id> Optional if one Google Ads account is connected
|
|
6550
|
+
--fields <fields> Comma-separated response fields
|
|
6551
|
+
--limit <n> Maximum rows to return (list only)
|
|
6552
|
+
--offset <n> Rows to skip (list only)
|
|
6553
|
+
|
|
6554
|
+
Flags (create):
|
|
6555
|
+
--name <name> Conversion action name (required for create)
|
|
6556
|
+
--type <type> Conversion action type (required for create)
|
|
6557
|
+
--category <value> Conversion category (required for create)
|
|
6558
|
+
--status <status> enabled (create only)
|
|
6559
|
+
--counting-type <t> one or many
|
|
6560
|
+
--default-value <n> Non-negative default conversion value
|
|
6561
|
+
--currency <code> ISO currency code, e.g. USD
|
|
6562
|
+
--click-days <n> Positive click attribution window
|
|
6563
|
+
--view-days <n> Positive view attribution window
|
|
6564
|
+
--account <id> Optional if one Google Ads account is connected
|
|
6565
|
+
--publish Apply directly to Google instead of saving a draft
|
|
6566
|
+
--data <json> Exact body: {"conversions":[...]}
|
|
6567
|
+
|
|
6568
|
+
Flags (update):
|
|
6569
|
+
--name <name> New conversion action name
|
|
6570
|
+
--category <value> New conversion category
|
|
6571
|
+
--counting-type <t> one or many
|
|
6572
|
+
--default-value <n> Non-negative default conversion value
|
|
6573
|
+
--currency <code> ISO currency code, e.g. USD
|
|
6574
|
+
--account <id> Optional if one Google Ads account is connected
|
|
6575
|
+
--publish Apply directly to Google instead of saving a draft
|
|
6576
|
+
--data <json> Exact partial update object
|
|
6577
|
+
|
|
6446
6578
|
Flags (upload):
|
|
6447
6579
|
--conversion <id> Google conversion ID (platformId), must be type upload_clicks
|
|
6448
6580
|
--gclid <id> Google click ID
|
|
@@ -6459,13 +6591,38 @@ Flags (upload):
|
|
|
6459
6591
|
--data <json> Batch body: {"conversions":[...],"validateOnly":true}
|
|
6460
6592
|
|
|
6461
6593
|
Examples:
|
|
6594
|
+
adkit manage google conversions list --account 1234567890
|
|
6595
|
+
adkit manage google conversions get 123456 --account 1234567890
|
|
6596
|
+
adkit manage google conversions create --name "Qualified lead" --type upload_clicks --category submit_lead_form
|
|
6597
|
+
adkit manage google conversions update 123456 --name "Qualified lead v2" --publish
|
|
6598
|
+
adkit manage google conversions delete 123456
|
|
6462
6599
|
adkit manage google conversions upload --conversion 123 --gclid EAIaIQob... --occurred-at "2026-06-24 13:45:00+00:00" --value 120 --currency USD --validate-only
|
|
6463
6600
|
adkit manage google conversions upload --data '{"conversions":[{"conversionId":"123","gclid":"EAIaIQob...","occurredAt":"2026-06-24 13:45:00+00:00","value":120,"currency":"USD"}],"validateOnly":true}' --account 1234567890
|
|
6464
6601
|
|
|
6465
6602
|
Notes:
|
|
6603
|
+
Create, update, and delete save a draft by default. Pass --publish to apply immediately.
|
|
6604
|
+
Google conversion actions do not support paused. Use delete for removal.
|
|
6605
|
+
Use --data for advanced fields such as isPrimary and alwaysUseDefaultValue.
|
|
6466
6606
|
Upload sends events directly to Google; it is not a draft flow.
|
|
6467
6607
|
Use --validate-only before a real upload when testing a new CRM/backend export.
|
|
6468
6608
|
Real uploads require publish access.`;
|
|
6609
|
+
var META_CONVERSIONS_HELP = `adkit manage meta conversions \u2014 Meta Custom Conversions
|
|
6610
|
+
|
|
6611
|
+
list List configured custom conversions
|
|
6612
|
+
|
|
6613
|
+
Flags (list):
|
|
6614
|
+
--account <id> Optional if one Meta ad account is connected
|
|
6615
|
+
--limit <n> Maximum rows to return
|
|
6616
|
+
--offset <n> Rows to skip
|
|
6617
|
+
--raw Return raw Meta custom conversion rows
|
|
6618
|
+
|
|
6619
|
+
Notes:
|
|
6620
|
+
This command is read-only. Create or edit custom conversions in Meta Events Manager.
|
|
6621
|
+
Use platformId from a result with: adkit manage meta results --conversion-event-keys <id>
|
|
6622
|
+
For conversion counts, CPA, and ROAS, use meta results instead.
|
|
6623
|
+
|
|
6624
|
+
Example:
|
|
6625
|
+
adkit manage meta conversions list --account act_123`;
|
|
6469
6626
|
var META_RESEARCH_HELP = `adkit manage meta research \u2014 Meta Ads research tools
|
|
6470
6627
|
|
|
6471
6628
|
interests <query> Search targeting interests (returns IDs for ad set targeting)
|
|
@@ -6504,6 +6661,7 @@ Examples:
|
|
|
6504
6661
|
"meta results": RESULTS_HELP,
|
|
6505
6662
|
"meta creatives": CREATIVE_HELP,
|
|
6506
6663
|
"meta lead-forms": LEAD_FORM_HELP,
|
|
6664
|
+
"meta conversions": META_CONVERSIONS_HELP,
|
|
6507
6665
|
"google accounts": `adkit manage google accounts \u2014 Google Ads accounts
|
|
6508
6666
|
|
|
6509
6667
|
list List connected Google Ads accounts
|
|
@@ -6955,6 +7113,7 @@ Entity groups:
|
|
|
6955
7113
|
adsets Manage ad sets
|
|
6956
7114
|
ads Manage ads
|
|
6957
7115
|
lead-forms List existing Meta Instant Forms (supporting asset)
|
|
7116
|
+
conversions List configured Meta Custom Conversions
|
|
6958
7117
|
results Performance metrics (spend, clicks, conversions) \u2014 not in list commands
|
|
6959
7118
|
creatives Manage ad creatives (prefer using ads with --media instead)
|
|
6960
7119
|
research Research targeting interests
|
|
@@ -8534,6 +8693,16 @@ async function main() {
|
|
|
8534
8693
|
}
|
|
8535
8694
|
break;
|
|
8536
8695
|
}
|
|
8696
|
+
case "conversions": {
|
|
8697
|
+
if (!action || flags.help) {
|
|
8698
|
+
showHelp("meta conversions");
|
|
8699
|
+
return;
|
|
8700
|
+
}
|
|
8701
|
+
if (action !== "list") throw new CliError("UNKNOWN_COMMAND", `Unknown action: meta conversions ${action}`, "Available: list");
|
|
8702
|
+
data = await listMetaConversions(client, restArgs, flags);
|
|
8703
|
+
emptyHint = "No Meta Custom Conversions found. Standard events such as purchase and lead do not appear in this list.";
|
|
8704
|
+
break;
|
|
8705
|
+
}
|
|
8537
8706
|
case "creatives": {
|
|
8538
8707
|
switch (action) {
|
|
8539
8708
|
case "create":
|
|
@@ -8579,7 +8748,7 @@ async function main() {
|
|
|
8579
8748
|
break;
|
|
8580
8749
|
}
|
|
8581
8750
|
default:
|
|
8582
|
-
throw new CliError("UNKNOWN_COMMAND", `Unknown entity: meta ${entity}`, "Available: accounts, campaigns, adsets, ads, lead-forms, results, creatives, media, research");
|
|
8751
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown entity: meta ${entity}`, "Available: accounts, campaigns, adsets, ads, lead-forms, conversions, results, creatives, media, research");
|
|
8583
8752
|
}
|
|
8584
8753
|
} else if (platform2 === "google") {
|
|
8585
8754
|
switch (entity) {
|
|
@@ -8851,11 +9020,27 @@ async function main() {
|
|
|
8851
9020
|
return;
|
|
8852
9021
|
}
|
|
8853
9022
|
switch (action) {
|
|
9023
|
+
case "list":
|
|
9024
|
+
data = await listGoogleConversions(client, restArgs, flags);
|
|
9025
|
+
emptyHint = "No Google conversion actions found for this account.";
|
|
9026
|
+
break;
|
|
9027
|
+
case "get":
|
|
9028
|
+
data = await getGoogleConversion(client, restArgs, flags);
|
|
9029
|
+
break;
|
|
9030
|
+
case "create":
|
|
9031
|
+
data = await createGoogleConversion(client, restArgs, flags);
|
|
9032
|
+
break;
|
|
9033
|
+
case "update":
|
|
9034
|
+
data = await updateGoogleConversion(client, restArgs, flags);
|
|
9035
|
+
break;
|
|
9036
|
+
case "delete":
|
|
9037
|
+
data = await deleteGoogleConversion(client, restArgs, flags);
|
|
9038
|
+
break;
|
|
8854
9039
|
case "upload":
|
|
8855
9040
|
data = await uploadGoogleConversions(client, restArgs, flags);
|
|
8856
9041
|
break;
|
|
8857
9042
|
default:
|
|
8858
|
-
throw new CliError("UNKNOWN_COMMAND", `Unknown action: google conversions ${action}`, "Available: upload");
|
|
9043
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown action: google conversions ${action}`, "Available: list, get, create, update, delete, upload");
|
|
8859
9044
|
}
|
|
8860
9045
|
break;
|
|
8861
9046
|
}
|
package/package.json
CHANGED