@metricraven/cli 0.4.3 → 0.4.5

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 CHANGED
@@ -44,7 +44,7 @@ The token is saved to `~/.config/metricraven/config.json` (or `$XDG_CONFIG_HOME/
44
44
  | `analytics insights` | What converts and how long buyers take |
45
45
  | `analytics search` | Google Search Console queries |
46
46
  | `analytics crawlers` | AI crawlers and bots |
47
- | `analytics ads [campaign\|adgroup\|ad] [--provider all\|meta\|google\|tiktok] [--account <id>]` | Ad spend from every connected network, attributed and assisted revenue, ROAS and cost per customer, with each network's own reported value (Meta-reported, Google-reported) for comparison. `--account` reports one chosen ad account alone (the IDs are listed when several are combined; Google IDs with or without dashes, Meta without `act_`) |
47
+ | `analytics ads [campaign\|adgroup\|ad] [--provider all\|meta\|google] [--account <id>]` | Ad spend from every connected network, attributed and assisted revenue, ROAS and cost per customer, with each network's own reported value (Meta-reported, Google-reported) for comparison. `--account` reports one chosen ad account alone (the IDs are listed when several are combined; Google IDs with or without dashes, Meta without `act_`) |
48
48
  | `analytics meta-ads [campaign\|adset\|ad] [--account <id>]` | Meta Ads spend, attributed revenue, ROAS and cost per customer |
49
49
  | `realtime` | Visitors online now |
50
50
  | `visitors list`, `visitors get <id>` | Visitors and journeys (token needs visitor details access) |
package/dist/args.js CHANGED
@@ -43,6 +43,7 @@ const OPTIONS = {
43
43
  description: { type: "string" },
44
44
  hidden: { type: "boolean" },
45
45
  visible: { type: "boolean" },
46
+ category: { type: "string" },
46
47
  company: { type: "boolean" },
47
48
  // analytics ads
48
49
  provider: { type: "string" },
package/dist/commands.js CHANGED
@@ -273,7 +273,7 @@ async function analytics(ctx, sub, rest) {
273
273
  params.set("level", rest[0]);
274
274
  if (flags.provider) {
275
275
  if (!AD_PROVIDER_VALUES.includes(flags.provider))
276
- throw new UsageError("Use --provider all, meta, google or tiktok.");
276
+ throw new UsageError("Use --provider all, meta or google.");
277
277
  params.set("provider", flags.provider);
278
278
  }
279
279
  if (flags.account)
@@ -319,7 +319,7 @@ function renderAds(d) {
319
319
  if (!d.configured)
320
320
  return d.reason === "no_account"
321
321
  ? "An ad network is connected but no ad account is chosen yet. Pick one in Settings → Integrations."
322
- : "No ad network is connected for this website. Connect Meta Ads, Google Ads or TikTok Ads in the dashboard: https://metricraven.com/docs/meta-ads";
322
+ : "No ad network is connected for this website. Connect Meta Ads or Google Ads in the dashboard: https://metricraven.com/docs/meta-ads";
323
323
  const cur = d.period?.currency ?? "USD";
324
324
  const t = d.totals;
325
325
  const roas = (v) => (v === null || v === undefined ? "–" : `${num(v, 2)}x`);
@@ -738,6 +738,7 @@ async function aiVisibility(ctx) {
738
738
  }
739
739
  /** "Signup started (signup_started)" when the goal has a display name, else the raw name. */
740
740
  const goalText = (g) => g.displayName && g.displayName !== g.name ? `${g.displayName} (${g.name})` : g.name;
741
+ const CATEGORY_CHOICES = ["conversion", "engagement", "none", "default"];
741
742
  /** `metricraven goals …`: how goals are shown (display name, colour, description, hidden). */
742
743
  async function goals(ctx, sub, rest) {
743
744
  const { flags, client } = ctx;
@@ -759,7 +760,7 @@ async function goals(ctx, sub, rest) {
759
760
  return printJson(d), 0;
760
761
  if (!d.customizations.length)
761
762
  return out(dim("No goal customisations yet. Use `metricraven goals set <goal> --name <label>`.")), 0;
762
- out(table(["Goal", "Display name", "Colour", "Hidden", "Description"], d.customizations.map((c) => [c.goal, c.displayName ?? "–", colorText(c.color, d.colors), c.hidden ? "yes" : "no", c.description ? truncate(c.description, 50) : "–"])));
763
+ out(table(["Goal", "Display name", "Colour", "Counts as", "Hidden", "Description"], d.customizations.map((c) => [c.goal, c.displayName ?? "–", colorText(c.color, d.colors), c.category ?? "default", c.hidden ? "yes" : "no", c.description ? truncate(c.description, 50) : "–"])));
763
764
  return 0;
764
765
  }
765
766
  case "colors":
@@ -792,17 +793,22 @@ async function goals(ctx, sub, rest) {
792
793
  body.color = match.color;
793
794
  }
794
795
  }
796
+ if (flags.category !== undefined) {
797
+ if (!CATEGORY_CHOICES.includes(flags.category))
798
+ throw new UsageError(`--category must be one of: ${CATEGORY_CHOICES.join(", ")}.`);
799
+ body.category = flags.category === "default" ? null : flags.category;
800
+ }
795
801
  if (flags.hidden)
796
802
  body.hidden = true;
797
803
  if (flags.visible)
798
804
  body.hidden = false;
799
805
  if (Object.keys(body).length === 1)
800
- throw new UsageError("Nothing to change. Use --name, --color, --description, --hidden or --visible.");
806
+ throw new UsageError("Nothing to change. Use --name, --color, --description, --category, --hidden or --visible.");
801
807
  const d = await needs("write", client.put("/goals/customizations", body, params()));
802
808
  if (flags.json)
803
809
  return printJson(d), 0;
804
810
  const c = d.customization;
805
- out(`Saved ${bold(goalText({ name: c.goal, displayName: c.displayName }))}: colour ${colorText(c.color, d.colors)}, ${c.hidden ? "hidden" : "visible"}.`);
811
+ out(`Saved ${bold(goalText({ name: c.goal, displayName: c.displayName }))}: colour ${colorText(c.color, d.colors)}, counts as ${c.category ?? "default"}, ${c.hidden ? "hidden" : "visible"}.`);
806
812
  return 0;
807
813
  }
808
814
  case "reset": {
@@ -1,6 +1,7 @@
1
1
  import { UsageError } from "./args.js";
2
2
  /** --provider values of `analytics ads`: what GET /stats/ads accepts. */
3
- export const AD_PROVIDER_VALUES = ["all", "meta", "google", "tiktok"];
3
+ /** The ad networks customers can choose (TikTok Ads is hidden until listed: core/ads.ts TIKTOK_ADS_LISTED). */
4
+ export const AD_PROVIDER_VALUES = ["all", "meta", "google"];
4
5
  /** Shell completion scripts for `metricraven completion bash|zsh|fish`. */
5
6
  const COMMANDS = ["login", "logout", "whoami", "account", "tokens", "payments", "use", "websites", "analytics", "realtime", "visitors", "funnels", "goals", "notes", "mentions", "ai-visibility", "alerts", "members", "bots", "proxy", "completion"];
6
7
  const SUB = {
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ Reports (default: last 30 days)
49
49
  analytics search Google Search Console queries
50
50
  analytics crawlers AI crawlers and bots
51
51
  analytics ads [level] Ad spend, revenue and ROAS for every connected network
52
- (campaign, adgroup or ad; --provider all|meta|google|tiktok;
52
+ (campaign, adgroup or ad; --provider all|meta|google;
53
53
  --account <id>: one chosen ad account alone)
54
54
  analytics meta-ads [level] Meta Ads spend, revenue and ROAS by campaign, adset or ad
55
55
  (--account <id>: one ad account alone)
@@ -63,6 +63,7 @@ Reports (default: last 30 days)
63
63
  funnels list Saved funnels
64
64
  goals list Goal display settings (name, colour, hidden)
65
65
  goals set <goal> [--name <label>] [--color <hex|name>] [--description]
66
+ [--category conversion|engagement|none|default]
66
67
  [--hidden | --visible] (needs write access, admin);
67
68
  pass "" to clear a text field or colour
68
69
  goals reset <goal> Back to the raw name, default colour, visible
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metricraven/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "MetricRaven from your terminal: traffic, revenue, goals, visitors and websites. Built for people and AI agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",