$npx -y skills add adobe/skills --skill cja-segment-performance-comparatorCompares the performance of two or more audience segments across key metrics side by side. Use this skill when someone wants to compare audiences, cohorts, or groups — for example, "how do mobile users compare to desktop users on conversion," "compare new vs. returning visitors,"
| 1 | # Segment Performance Comparator (Customer Journey Analytics) |
| 2 | |
| 3 | Compare 2–5 audience segments across a set of key metrics in a side-by-side |
| 4 | matrix. The output tells the user not just what each segment looks like in |
| 5 | isolation, but which segment wins or loses on each metric — and which |
| 6 | differences are large enough to act on. |
| 7 | |
| 8 | This skill answers the question "which audience should we focus on?" with data. |
| 9 | Segment comparisons drive product decisions, personalization strategy, and |
| 10 | budget allocation — so clarity and actionability matter more than exhaustive data. |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## CJA MCP Tools Used |
| 15 | |
| 16 | - `findSegments` — search for segments by name or keyword |
| 17 | - `describeSegment` — understand the logic of candidate segments before using them |
| 18 | - `findMetrics` — resolve base metric IDs |
| 19 | - `findCalculatedMetrics` — include custom KPIs in the comparison |
| 20 | - `listComponentUsage` — identify the most-used metrics as default comparison set |
| 21 | - `runReport` (with `segmentIds` or `adhocSegments`) — pull metric values per segment |
| 22 | |
| 23 | --- |
| 24 | |
| 25 | ## Phase 0 — Setup |
| 26 | |
| 27 | 1. Call `findDataViews` to list available data views. |
| 28 | 2. If the user hasn't specified a data view, present the list and ask which to use. |
| 29 | 3. Call `setDefaultSessionDataViewId` with the chosen ID. |
| 30 | 4. Ask the user which segments to compare if not already specified. Confirm the metrics to compare them on. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## Phase 1 — Identify Segments to Compare |
| 35 | |
| 36 | ### 1.1 From user description |
| 37 | |
| 38 | If the user named specific segments, resolve them: |
| 39 | ``` |
| 40 | findSegments(search: "<segment name>") |
| 41 | ``` |
| 42 | |
| 43 | For each match, call `describeSegment` to verify it is the correct one: |
| 44 | ``` |
| 45 | describeSegment(segmentId: "<id>") |
| 46 | ``` |
| 47 | |
| 48 | Show the segment definition summary to the user if there is ambiguity: |
| 49 | > "I found two segments matching 'mobile users': **Mobile Visitors (All Devices)** |
| 50 | > and **Mobile App Users**. Which do you want to compare?" |
| 51 | |
| 52 | ### 1.2 From plain-English descriptions |
| 53 | |
| 54 | If the user says "compare mobile vs desktop users" but there are no matching |
| 55 | segments, offer to create ad hoc segments inline for the comparison: |
| 56 | > "I don't see pre-built segments for mobile and desktop. I can create |
| 57 | > temporary ad hoc segments for this comparison using device type. Should I |
| 58 | > proceed with ad hoc segments, or would you like to create permanent segments |
| 59 | > first?" |
| 60 | |
| 61 | Ad hoc segments are constructed using `adhocSegments` in `runReport` — no |
| 62 | save required for the comparison itself. |
| 63 | |
| 64 | ### 1.3 Segment count limit |
| 65 | |
| 66 | Maximum 5 segments for a single comparison. More than 5 creates a matrix |
| 67 | that is too wide to read meaningfully. If the user requests more, say: |
| 68 | > "I'll limit to the 5 most relevant segments for readability. Would you like |
| 69 | > me to prioritize by usage count or stick with your list order?" |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## Phase 2 — Identify Metrics to Compare |
| 74 | |
| 75 | ### 2.1 From user specification |
| 76 | |
| 77 | Resolve named metrics via `findMetrics` and `findCalculatedMetrics`. |
| 78 | |
| 79 | ### 2.2 Default metric discovery |
| 80 | |
| 81 | If the user did not specify metrics, pull the top metrics by usage. The |
| 82 | `listComponentUsage` tool does not support a `limit` parameter — it returns all |
| 83 | components ranked by usage count; take the top 6–8 from the result: |
| 84 | ``` |
| 85 | listComponentUsage(componentType: "metric") |
| 86 | listComponentUsage(componentType: "calculatedMetric") |
| 87 | ``` |
| 88 | |
| 89 | Prefer calculated metrics over raw base metrics when they measure the same |
| 90 | thing — calculated metrics reflect intentional KPI definitions. |
| 91 | |
| 92 | ### 2.3 Metric selection for a comparison |
| 93 | |
| 94 | Good comparison metrics should be meaningful across all segments. For example, |
| 95 | "Revenue" is meaningful for both mobile and desktop users; "App Installs" is |
| 96 | only meaningful for mobile. Remove metrics that would be trivially zero for |
| 97 | one segment. |
| 98 | |
| 99 | If unsure, ask: "Should I use your standard KPI set, or focus on specific |
| 100 | metrics like conversion rate, revenue, and engagement?" |
| 101 | |
| 102 | --- |
| 103 | |
| 104 | ## Phase 3 — Run the Comparison |
| 105 | |
| 106 | For each segment, run a `runReport` with that segment applied and all |
| 107 | comparison metrics included. Note that `runReport` takes `metricIds` as a |
| 108 | comma-separated string, `startDate`/`endDate` (not `dateRange`), and a |
| 109 | `dimensionIds` (required even for summary-only reports — use a low-cardinality |
| 110 | dimension like `variables/daterangeday` or `variables/web.webPageDetails.name`). |
| 111 | The summary totals for all metrics are in `summaryData.filteredTotals`: |
| 112 | |
| 113 | ``` |
| 114 | runReport( |
| 115 | dimensionIds: "variables/web.webPageDetails.name", |
| 116 | metricIds: "metrics/visits,met |