@apex-inc/mcp-server 0.71.0 → 0.73.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/dist/setup-catchup-tools.d.ts +51 -14
- package/dist/setup-catchup-tools.d.ts.map +1 -1
- package/dist/setup-catchup-tools.js +146 -21
- package/dist/setup-catchup-tools.js.map +1 -1
- package/dist/setup-checklist.d.ts +1 -0
- package/dist/setup-checklist.d.ts.map +1 -1
- package/dist/setup-checklist.js +2 -1
- package/dist/setup-checklist.js.map +1 -1
- package/dist/smoke-tools.d.ts.map +1 -1
- package/dist/smoke-tools.js +2 -0
- package/dist/smoke-tools.js.map +1 -1
- package/dist/tool-catalog.js +1 -1
- package/dist/tool-catalog.js.map +1 -1
- package/dist/tool-groups.d.ts.map +1 -1
- package/dist/tool-groups.js +5 -0
- package/dist/tool-groups.js.map +1 -1
- package/dist/tools/experiments.js +1 -1
- package/dist/tools/experiments.js.map +1 -1
- package/dist/tools/letters.d.ts +200 -1
- package/dist/tools/letters.d.ts.map +1 -1
- package/dist/tools/letters.js +134 -6
- package/dist/tools/letters.js.map +1 -1
- package/dist/tools/measurement.d.ts +82 -6
- package/dist/tools/measurement.d.ts.map +1 -1
- package/dist/tools/measurement.js +164 -26
- package/dist/tools/measurement.js.map +1 -1
- package/dist/tools/partners.d.ts +14 -14
- package/dist/tools.d.ts +353 -28
- package/dist/tools.d.ts.map +1 -1
- package/dist/workspace-target-url.d.ts.map +1 -1
- package/dist/workspace-target-url.js +8 -3
- package/dist/workspace-target-url.js.map +1 -1
- package/package.json +1 -1
|
@@ -200,19 +200,43 @@ export declare const setupCatchupTools: {
|
|
|
200
200
|
claim_links_subdomain: {
|
|
201
201
|
description: string;
|
|
202
202
|
schema: z.ZodObject<{
|
|
203
|
-
subdomain: z.ZodString
|
|
203
|
+
subdomain: z.ZodOptional<z.ZodString>;
|
|
204
|
+
retirePrevious: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
retireSubdomain: z.ZodOptional<z.ZodString>;
|
|
204
206
|
}, "strip", z.ZodTypeAny, {
|
|
205
|
-
subdomain
|
|
207
|
+
subdomain?: string | undefined;
|
|
208
|
+
retirePrevious?: boolean | undefined;
|
|
209
|
+
retireSubdomain?: string | undefined;
|
|
206
210
|
}, {
|
|
207
|
-
subdomain
|
|
211
|
+
subdomain?: string | undefined;
|
|
212
|
+
retirePrevious?: boolean | undefined;
|
|
213
|
+
retireSubdomain?: string | undefined;
|
|
208
214
|
}>;
|
|
209
|
-
handler: (
|
|
210
|
-
subdomain
|
|
215
|
+
handler: (args: {
|
|
216
|
+
subdomain?: string;
|
|
217
|
+
retirePrevious?: boolean;
|
|
218
|
+
retireSubdomain?: string;
|
|
211
219
|
}) => Promise<{
|
|
212
220
|
content: {
|
|
213
221
|
type: "text";
|
|
214
222
|
text: string;
|
|
215
223
|
}[];
|
|
224
|
+
} | {
|
|
225
|
+
isError: boolean;
|
|
226
|
+
content: {
|
|
227
|
+
type: "text";
|
|
228
|
+
text: string;
|
|
229
|
+
}[];
|
|
230
|
+
}>;
|
|
231
|
+
};
|
|
232
|
+
rotate_public_workspace_id: {
|
|
233
|
+
description: string;
|
|
234
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
235
|
+
handler: () => Promise<{
|
|
236
|
+
content: {
|
|
237
|
+
type: "text";
|
|
238
|
+
text: string;
|
|
239
|
+
}[];
|
|
216
240
|
}>;
|
|
217
241
|
};
|
|
218
242
|
get_link_domain: {
|
|
@@ -287,8 +311,16 @@ export declare const setupCatchupTools: {
|
|
|
287
311
|
};
|
|
288
312
|
get_team_traffic: {
|
|
289
313
|
description: string;
|
|
290
|
-
schema: z.ZodObject<{
|
|
291
|
-
|
|
314
|
+
schema: z.ZodObject<{
|
|
315
|
+
host: z.ZodOptional<z.ZodString>;
|
|
316
|
+
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
host?: string | undefined;
|
|
318
|
+
}, {
|
|
319
|
+
host?: string | undefined;
|
|
320
|
+
}>;
|
|
321
|
+
handler: (args?: {
|
|
322
|
+
host?: string;
|
|
323
|
+
}) => Promise<{
|
|
292
324
|
content: {
|
|
293
325
|
type: "text";
|
|
294
326
|
text: string;
|
|
@@ -301,11 +333,14 @@ export declare const setupCatchupTools: {
|
|
|
301
333
|
addMyAddress: z.ZodOptional<z.ZodBoolean>;
|
|
302
334
|
addresses: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
303
335
|
browserLink: z.ZodOptional<z.ZodEnum<["create", "remove"]>>;
|
|
336
|
+
host: z.ZodOptional<z.ZodString>;
|
|
304
337
|
}, "strip", z.ZodTypeAny, {
|
|
338
|
+
host?: string | undefined;
|
|
305
339
|
addMyAddress?: boolean | undefined;
|
|
306
340
|
addresses?: string[] | undefined;
|
|
307
341
|
browserLink?: "create" | "remove" | undefined;
|
|
308
342
|
}, {
|
|
343
|
+
host?: string | undefined;
|
|
309
344
|
addMyAddress?: boolean | undefined;
|
|
310
345
|
addresses?: string[] | undefined;
|
|
311
346
|
browserLink?: "create" | "remove" | undefined;
|
|
@@ -314,6 +349,7 @@ export declare const setupCatchupTools: {
|
|
|
314
349
|
addMyAddress?: boolean;
|
|
315
350
|
addresses?: string[];
|
|
316
351
|
browserLink?: "create" | "remove";
|
|
352
|
+
host?: string;
|
|
317
353
|
}) => Promise<{
|
|
318
354
|
content: {
|
|
319
355
|
type: "text";
|
|
@@ -1302,6 +1338,7 @@ export declare const setupCatchupTools: {
|
|
|
1302
1338
|
placement: z.ZodOptional<z.ZodEnum<["paid-ad", "social-post", "social-bio", "other"]>>;
|
|
1303
1339
|
platform: z.ZodOptional<z.ZodString>;
|
|
1304
1340
|
source: z.ZodOptional<z.ZodString>;
|
|
1341
|
+
medium: z.ZodOptional<z.ZodString>;
|
|
1305
1342
|
slug: z.ZodOptional<z.ZodString>;
|
|
1306
1343
|
name: z.ZodOptional<z.ZodString>;
|
|
1307
1344
|
campaignName: z.ZodOptional<z.ZodString>;
|
|
@@ -1320,6 +1357,7 @@ export declare const setupCatchupTools: {
|
|
|
1320
1357
|
storeRouting?: boolean | undefined;
|
|
1321
1358
|
placement?: "other" | "paid-ad" | "social-post" | "social-bio" | undefined;
|
|
1322
1359
|
source?: string | undefined;
|
|
1360
|
+
medium?: string | undefined;
|
|
1323
1361
|
campaignName?: string | undefined;
|
|
1324
1362
|
variant?: string | undefined;
|
|
1325
1363
|
previewTitle?: string | undefined;
|
|
@@ -1336,6 +1374,7 @@ export declare const setupCatchupTools: {
|
|
|
1336
1374
|
storeRouting?: boolean | undefined;
|
|
1337
1375
|
placement?: "other" | "paid-ad" | "social-post" | "social-bio" | undefined;
|
|
1338
1376
|
source?: string | undefined;
|
|
1377
|
+
medium?: string | undefined;
|
|
1339
1378
|
campaignName?: string | undefined;
|
|
1340
1379
|
variant?: string | undefined;
|
|
1341
1380
|
previewTitle?: string | undefined;
|
|
@@ -1352,6 +1391,7 @@ export declare const setupCatchupTools: {
|
|
|
1352
1391
|
placement?: CreateLinkPlacement;
|
|
1353
1392
|
platform?: string;
|
|
1354
1393
|
source?: string;
|
|
1394
|
+
medium?: string;
|
|
1355
1395
|
slug?: string;
|
|
1356
1396
|
name?: string;
|
|
1357
1397
|
campaignName?: string;
|
|
@@ -1618,15 +1658,12 @@ export declare const setupCatchupTools: {
|
|
|
1618
1658
|
export declare function resolvePaidPlatform(raw: string): string | null;
|
|
1619
1659
|
export declare function resolveOrganicPlatform(raw: string): string | null;
|
|
1620
1660
|
export declare function mediumForPaidAd(platform: string): string;
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
* (`app/src/lib/links/placements.ts`). Organic placements must write
|
|
1624
|
-
* `social`: the channel rules only file a visit as Organic Social on that
|
|
1625
|
-
* medium, and a paid medium bills the visit as an attributed conversion.
|
|
1626
|
-
*/
|
|
1627
|
-
export declare function resolveLinkUtm(placement: CreateLinkPlacement, rawPlatform: string, rawSource?: string): {
|
|
1661
|
+
export declare function utmTagFromInput(value: string): string;
|
|
1662
|
+
export declare function resolveLinkUtm(placement: CreateLinkPlacement, rawPlatform: string, rawSource?: string, rawMedium?: string): {
|
|
1628
1663
|
source?: string;
|
|
1629
1664
|
medium: string;
|
|
1665
|
+
} | {
|
|
1666
|
+
error: string;
|
|
1630
1667
|
} | null;
|
|
1631
1668
|
export declare function resolveMeasurementNetwork(raw: string): string;
|
|
1632
1669
|
export declare function slugFromName(name: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-catchup-tools.d.ts","sourceRoot":"","sources":["../src/setup-catchup-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,8FAA8F;AAC9F,eAAO,MAAM,oBAAoB,4JAMvB,CAAC;AA4BX,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,sGAMnB,CAAC;AAmCX,QAAA,MAAM,SAAS,sEAML,CAAC;AAEX,QAAA,MAAM,iBAAiB,iFAMb,CAAC;AAEX,QAAA,MAAM,eAAe,gFAQX,CAAC;AAEX,2GAA2G;AAC3G,QAAA,MAAM,sBAAsB,4DAA6D,CAAC;AAC1F,KAAK,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAkBnE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;mCAUO;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kGA8C9D;YACD,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,EAAE,CAAC,OAAO,SAAS,EAAE,MAAM,CAAC,CAAC;YACtC,eAAe,CAAC,EAAE,CAAC,OAAO,iBAAiB,EAAE,MAAM,CAAC,CAAC;YACrD,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;YACrC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AM,CAE9C;AAwBD,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc;;;;;;;;;;;;;;;EAenD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
|
|
@@ -337,20 +337,54 @@ export const setupCatchupTools = {
|
|
|
337
337
|
},
|
|
338
338
|
},
|
|
339
339
|
claim_links_subdomain: {
|
|
340
|
-
description: `${APEX} — Claim the workspace's links subdomain (name.links.apex.inc). Same save as
|
|
340
|
+
description: `${APEX} — Claim or change the workspace's links subdomain (name.links.apex.inc). Same save as Settings → Workspace → Links. Admin only. Fails if another workspace already holds that name. By default, changing subdomains keeps the old subdomain resolving so already-shared links don't break; pass retire_previous: true (or retire_subdomain: "<old>") to explicitly stop resolving an old subdomain (for example one derived from an earlier workspace name).`,
|
|
341
341
|
schema: z.object({
|
|
342
342
|
subdomain: z
|
|
343
343
|
.string()
|
|
344
344
|
.min(1)
|
|
345
|
-
.
|
|
345
|
+
.optional()
|
|
346
|
+
.describe("New subdomain only, e.g. acme — not the full hostname. Required unless only retiring an old subdomain via retire_subdomain."),
|
|
347
|
+
retirePrevious: z
|
|
348
|
+
.boolean()
|
|
349
|
+
.optional()
|
|
350
|
+
.describe("Set true when changing subdomain to immediately release and stop resolving the previous subdomain."),
|
|
351
|
+
retireSubdomain: z
|
|
352
|
+
.string()
|
|
353
|
+
.min(1)
|
|
354
|
+
.optional()
|
|
355
|
+
.describe("Explicitly release and stop resolving a previously held subdomain (must not be the active subdomain)."),
|
|
346
356
|
}),
|
|
347
|
-
handler: async (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
handler: async (args) => {
|
|
358
|
+
if (!args.subdomain?.trim() && !args.retireSubdomain?.trim()) {
|
|
359
|
+
return {
|
|
360
|
+
isError: true,
|
|
361
|
+
content: [
|
|
362
|
+
{
|
|
363
|
+
type: "text",
|
|
364
|
+
text: `${APEX} Provide subdomain (to claim or change) or retire_subdomain (to retire an old subdomain).`,
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const body = {};
|
|
370
|
+
if (args.subdomain?.trim())
|
|
371
|
+
body.linkSubdomain = args.subdomain.trim();
|
|
372
|
+
if (args.retirePrevious === true)
|
|
373
|
+
body.retirePreviousLinkSubdomain = true;
|
|
374
|
+
if (args.retireSubdomain?.trim())
|
|
375
|
+
body.retireLinkSubdomain = args.retireSubdomain.trim();
|
|
376
|
+
const data = await apiPatch("/api/config", body);
|
|
351
377
|
return jsonResult(data);
|
|
352
378
|
},
|
|
353
379
|
},
|
|
380
|
+
rotate_public_workspace_id: {
|
|
381
|
+
description: `${APEX} — Generate or rotate a neutral, opaque public tracking ID (ws_<16 hex>) for this workspace so customer-facing HTML snippets and tracking requests never expose the original workspace name. Admin only. Internal workspace data stays untouched; existing installs using the workspace key keep working. If rotating an existing ws_... public ID, the previous public ID stops resolving and sites using it should update to the returned install_tag.`,
|
|
382
|
+
schema: z.object({}),
|
|
383
|
+
handler: async () => {
|
|
384
|
+
const res = await apiPost("/api/workspaces/public-id", {});
|
|
385
|
+
return jsonResult(res.data ?? res);
|
|
386
|
+
},
|
|
387
|
+
},
|
|
354
388
|
get_link_domain: {
|
|
355
389
|
description: `${APEX} — The workspace's own link domain (e.g. get.theirbrand.com): the host, where it stands, the one DNS record to add, and what is wrong if anything. Same as Settings → Links.`,
|
|
356
390
|
schema: z.object({}),
|
|
@@ -433,15 +467,21 @@ export const setupCatchupTools = {
|
|
|
433
467
|
},
|
|
434
468
|
},
|
|
435
469
|
get_team_traffic: {
|
|
436
|
-
description: `${APEX} — Read "Don't count my team": the home and office addresses whose visits are left out of visitor counts, page tests and ad platform sends, the link
|
|
437
|
-
schema: z.object({
|
|
438
|
-
|
|
439
|
-
|
|
470
|
+
description: `${APEX} — Read "Don't count my team": the home and office addresses whose visits are left out of visitor counts, page tests and ad platform sends, the browser-mark link(s) across every configured workspace host (browserMarkLink + browserMarkLinks), and whether the address this editor runs from is already listed. Note: ?apex_team= works on any host running the Apex snippet (opened once per domain); direct /api/events callers without the snippet should use IP exclusion (addresses) or pass teamMark.`,
|
|
471
|
+
schema: z.object({
|
|
472
|
+
host: z
|
|
473
|
+
.string()
|
|
474
|
+
.optional()
|
|
475
|
+
.describe("Optional hostname registered on this workspace to build browserMarkLink for. All workspace hosts are always returned in browserMarkLinks."),
|
|
476
|
+
}),
|
|
477
|
+
handler: async (args = {}) => {
|
|
478
|
+
const qs = args?.host?.trim() ? `?host=${encodeURIComponent(args.host.trim())}` : "";
|
|
479
|
+
const data = await apiGet(`/api/workspace/team-traffic${qs}`);
|
|
440
480
|
return jsonResult(data.data ?? data);
|
|
441
481
|
},
|
|
442
482
|
},
|
|
443
483
|
set_team_traffic: {
|
|
444
|
-
description: `${APEX} — Turn on "Don't count my team" so the owner's own visits stop counting as visitors, in page tests and in what Apex sends to ad platforms. Call it during setup: by default it adds the address this editor is running from, which is the owner's home or office. Visits stay on the record, labeled as the team; a team member's real purchase still counts as revenue. Admin only.`,
|
|
484
|
+
description: `${APEX} — Turn on "Don't count my team" so the owner's own visits stop counting as visitors, in page tests and in what Apex sends to ad platforms. Call it during setup: by default it adds the address this editor is running from, which is the owner's home or office. Visits stay on the record, labeled as the team; a team member's real purchase still counts as revenue. The browser link (?apex_team=...) works on any configured site running the Apex snippet (open it once per domain because browser storage is per origin); direct /api/events callers without the snippet should use IP exclusion (addresses) or pass teamMark. Admin only.`,
|
|
445
485
|
schema: z.object({
|
|
446
486
|
addMyAddress: z
|
|
447
487
|
.boolean()
|
|
@@ -455,26 +495,38 @@ export const setupCatchupTools = {
|
|
|
455
495
|
.enum(["create", "remove"])
|
|
456
496
|
.optional()
|
|
457
497
|
.describe("create: make a link that marks any browser (a phone, a teammate's laptop) as the team's when opened. remove: turn that link off."),
|
|
498
|
+
host: z
|
|
499
|
+
.string()
|
|
500
|
+
.optional()
|
|
501
|
+
.describe("Optional hostname registered on this workspace to build browserMarkLink for (all configured production/beta hosts are also returned in browserMarkLinks)."),
|
|
458
502
|
}),
|
|
459
503
|
handler: async (args) => {
|
|
460
504
|
let result = null;
|
|
461
|
-
|
|
505
|
+
const host = args.host?.trim();
|
|
506
|
+
const qs = host ? `?host=${encodeURIComponent(host)}` : "";
|
|
507
|
+
if (args.addresses !== undefined || args.browserLink !== undefined || host) {
|
|
462
508
|
const body = {};
|
|
463
509
|
if (args.addresses !== undefined)
|
|
464
510
|
body.addresses = args.addresses;
|
|
465
511
|
if (args.browserLink !== undefined)
|
|
466
512
|
body.browserMark = args.browserLink;
|
|
513
|
+
if (host)
|
|
514
|
+
body.host = host;
|
|
467
515
|
result = await apiPut("/api/workspace/team-traffic", body);
|
|
468
516
|
}
|
|
469
517
|
if (args.addMyAddress ?? true) {
|
|
470
|
-
result = await apiPost(
|
|
518
|
+
result = await apiPost(`/api/workspace/team-traffic/current-address${qs}`, {});
|
|
471
519
|
}
|
|
472
520
|
const data = result?.data ?? result;
|
|
473
|
-
const
|
|
521
|
+
const payload = (data ?? {});
|
|
522
|
+
const link = payload.browserMarkLink;
|
|
523
|
+
const multi = payload.browserMarkLinks && payload.browserMarkLinks.length > 1;
|
|
474
524
|
return jsonResult({
|
|
475
525
|
...data,
|
|
476
526
|
next: link
|
|
477
|
-
?
|
|
527
|
+
? multi
|
|
528
|
+
? `Saved. Open each host's link once in every browser you use (storage is per domain, and ?apex_team= works on any site running apex.js): ${payload.browserMarkLinks.map((l) => l.url).join(" · ")}`
|
|
529
|
+
: `Saved. Give the owner this link to open on their phone and any other browser they use away from this network (works on any site running apex.js; for direct /api/events callers without the snippet, exclude the IP or pass teamMark): ${link}`
|
|
478
530
|
: "Saved. To leave out their phone or a teammate's browser on another network, call set_team_traffic with browser_link: create and give them the link.",
|
|
479
531
|
});
|
|
480
532
|
},
|
|
@@ -1327,7 +1379,11 @@ export const setupCatchupTools = {
|
|
|
1327
1379
|
source: z
|
|
1328
1380
|
.string()
|
|
1329
1381
|
.optional()
|
|
1330
|
-
.describe("Required for other: the site, show, or community the link lives on (e.g. indie-hackers, product-hunt
|
|
1382
|
+
.describe("Required for other: the site, show, or community the link lives on (e.g. google_business, indie-hackers, product-hunt). Underscores are preserved in utm_source. Ignored for the other placements."),
|
|
1383
|
+
medium: z
|
|
1384
|
+
.string()
|
|
1385
|
+
.optional()
|
|
1386
|
+
.describe("Optional for placement 'other' only: custom non-paid utm_medium (e.g. local, direct_mail, podcast, community). Defaults to 'referral'. Paid mediums (cpc, paid_social, paid, etc.) are rejected — use placement: 'paid-ad' for paid traffic."),
|
|
1331
1387
|
slug: z
|
|
1332
1388
|
.string()
|
|
1333
1389
|
.optional()
|
|
@@ -1361,14 +1417,17 @@ export const setupCatchupTools = {
|
|
|
1361
1417
|
}),
|
|
1362
1418
|
handler: async (args) => {
|
|
1363
1419
|
const placement = args.placement ?? "paid-ad";
|
|
1364
|
-
const utm = resolveLinkUtm(placement, args.platform ?? "", args.source ?? "");
|
|
1420
|
+
const utm = resolveLinkUtm(placement, args.platform ?? "", args.source ?? "", args.medium);
|
|
1365
1421
|
if (!utm) {
|
|
1366
1422
|
return jsonResult(null, placement === "paid-ad"
|
|
1367
1423
|
? "Unknown ad platform. Use meta, google-ads, linkedin, tiktok, reddit, pinterest, or microsoft."
|
|
1368
1424
|
: placement === "other"
|
|
1369
|
-
? "Name where the link lives in source (e.g. indie-hackers). Without it, signups from this link credit nobody by name."
|
|
1425
|
+
? "Name where the link lives in source (e.g. google_business or indie-hackers). Without it, signups from this link credit nobody by name."
|
|
1370
1426
|
: "Unknown social platform. Use instagram, linkedin, x, tiktok, facebook, youtube, threads, reddit, or pinterest.");
|
|
1371
1427
|
}
|
|
1428
|
+
if ("error" in utm) {
|
|
1429
|
+
return jsonResult(null, utm.error);
|
|
1430
|
+
}
|
|
1372
1431
|
const slug = args.slug?.trim() ? slugFromName(args.slug) : undefined;
|
|
1373
1432
|
const preview = {
|
|
1374
1433
|
...(args.previewTitle?.trim() ? { title: args.previewTitle.trim() } : {}),
|
|
@@ -1384,11 +1443,22 @@ export const setupCatchupTools = {
|
|
|
1384
1443
|
title: args.name?.trim() || slug,
|
|
1385
1444
|
placement,
|
|
1386
1445
|
...(placement === "other" ? { source: utm.source } : { platform: utm.source }),
|
|
1446
|
+
...(placement === "other" && args.medium?.trim() ? { medium: utm.medium } : {}),
|
|
1387
1447
|
campaign: args.campaignName?.trim() || undefined,
|
|
1388
1448
|
variant: args.variant?.trim() || undefined,
|
|
1389
1449
|
...(Object.keys(preview).length > 0 ? { preview } : {}),
|
|
1390
1450
|
...(args.postUrl?.trim() ? { post_url: args.postUrl.trim() } : {}),
|
|
1391
1451
|
});
|
|
1452
|
+
const notes = [];
|
|
1453
|
+
if (placement === "other" && args.source?.trim() && args.source.trim() !== utm.source) {
|
|
1454
|
+
notes.push(`source normalized from "${args.source.trim()}" to "${utm.source}"`);
|
|
1455
|
+
}
|
|
1456
|
+
if (placement === "other" && args.medium?.trim() && args.medium.trim() !== utm.medium) {
|
|
1457
|
+
notes.push(`medium normalized from "${args.medium.trim()}" to "${utm.medium}"`);
|
|
1458
|
+
}
|
|
1459
|
+
if (notes.length > 0 && data && typeof data === "object") {
|
|
1460
|
+
return jsonResult({ ...data, normalization_note: notes.join("; ") });
|
|
1461
|
+
}
|
|
1392
1462
|
return jsonResult(data);
|
|
1393
1463
|
},
|
|
1394
1464
|
},
|
|
@@ -1694,10 +1764,65 @@ export function mediumForPaidAd(platform) {
|
|
|
1694
1764
|
* `social`: the channel rules only file a visit as Organic Social on that
|
|
1695
1765
|
* medium, and a paid medium bills the visit as an attributed conversion.
|
|
1696
1766
|
*/
|
|
1697
|
-
|
|
1767
|
+
const PAID_LINK_MEDIUMS = new Set([
|
|
1768
|
+
"cpc",
|
|
1769
|
+
"ppc",
|
|
1770
|
+
"cpm",
|
|
1771
|
+
"cpv",
|
|
1772
|
+
"cpa",
|
|
1773
|
+
"sem",
|
|
1774
|
+
"paid",
|
|
1775
|
+
"paid_social",
|
|
1776
|
+
"paid-social",
|
|
1777
|
+
"paidsocial",
|
|
1778
|
+
"paid_search",
|
|
1779
|
+
"paid-search",
|
|
1780
|
+
"paidsearch",
|
|
1781
|
+
"display",
|
|
1782
|
+
]);
|
|
1783
|
+
function isPaidLinkMedium(medium) {
|
|
1784
|
+
const m = medium.trim().toLowerCase();
|
|
1785
|
+
return PAID_LINK_MEDIUMS.has(m) || m.startsWith("paid");
|
|
1786
|
+
}
|
|
1787
|
+
export function utmTagFromInput(value) {
|
|
1788
|
+
if (!value)
|
|
1789
|
+
return "";
|
|
1790
|
+
const stripped = value
|
|
1791
|
+
.toLowerCase()
|
|
1792
|
+
.normalize("NFKD")
|
|
1793
|
+
.replace(/[^a-z0-9_-]+/g, "-")
|
|
1794
|
+
.replace(/-{2,}/g, "-")
|
|
1795
|
+
.replace(/^[-_]+/, "")
|
|
1796
|
+
.replace(/[-_]+$/, "");
|
|
1797
|
+
if (!stripped)
|
|
1798
|
+
return "";
|
|
1799
|
+
if (stripped.length <= 64)
|
|
1800
|
+
return stripped;
|
|
1801
|
+
return stripped.slice(0, 64).replace(/[-_]+$/, "");
|
|
1802
|
+
}
|
|
1803
|
+
export function resolveLinkUtm(placement, rawPlatform, rawSource = "", rawMedium) {
|
|
1804
|
+
if (rawMedium?.trim() && placement !== "other") {
|
|
1805
|
+
return {
|
|
1806
|
+
error: `medium can only be customized on placement "other". "${placement}" sets its own medium automatically.`,
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1698
1809
|
if (placement === "other") {
|
|
1699
|
-
const source =
|
|
1700
|
-
|
|
1810
|
+
const source = utmTagFromInput(rawSource);
|
|
1811
|
+
if (!source)
|
|
1812
|
+
return null;
|
|
1813
|
+
if (rawMedium?.trim()) {
|
|
1814
|
+
const medium = utmTagFromInput(rawMedium);
|
|
1815
|
+
if (!medium) {
|
|
1816
|
+
return { error: "medium must contain letters or numbers (e.g. local, referral, podcast)." };
|
|
1817
|
+
}
|
|
1818
|
+
if (isPaidLinkMedium(medium)) {
|
|
1819
|
+
return {
|
|
1820
|
+
error: `Paid medium "${medium}" belongs on placement "paid-ad" so spend and attribution report accurately.`,
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
return { source, medium };
|
|
1824
|
+
}
|
|
1825
|
+
return { source, medium: "referral" };
|
|
1701
1826
|
}
|
|
1702
1827
|
if (placement === "paid-ad") {
|
|
1703
1828
|
const source = resolvePaidPlatform(rawPlatform);
|