analytics-embedded-components

Use this skill when embedding a CRM Analytics dashboard into a Lightning App Builder page, Experience Cloud page, or when embedding a custom LWC inside an Analytics dashboard. Trigger keywords: wave-wave-dashboard-lwc, wave-community-dashboard, analytics__Dashboard target, embed dashboard, record-id context filtering, dashboard state JSON, analytics component. NOT for standard LWC development unrelated to Analytics dashboards, NOT for designing dashboard content or datasets, NOT for CRM Analytics app creation or dataset management.

Best use case

analytics-embedded-components is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use this skill when embedding a CRM Analytics dashboard into a Lightning App Builder page, Experience Cloud page, or when embedding a custom LWC inside an Analytics dashboard. Trigger keywords: wave-wave-dashboard-lwc, wave-community-dashboard, analytics__Dashboard target, embed dashboard, record-id context filtering, dashboard state JSON, analytics component. NOT for standard LWC development unrelated to Analytics dashboards, NOT for designing dashboard content or datasets, NOT for CRM Analytics app creation or dataset management.

Teams using analytics-embedded-components should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analytics-embedded-components/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/architect/analytics-embedded-components/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analytics-embedded-components/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analytics-embedded-components Compares

Feature / Agentanalytics-embedded-componentsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use this skill when embedding a CRM Analytics dashboard into a Lightning App Builder page, Experience Cloud page, or when embedding a custom LWC inside an Analytics dashboard. Trigger keywords: wave-wave-dashboard-lwc, wave-community-dashboard, analytics__Dashboard target, embed dashboard, record-id context filtering, dashboard state JSON, analytics component. NOT for standard LWC development unrelated to Analytics dashboards, NOT for designing dashboard content or datasets, NOT for CRM Analytics app creation or dataset management.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Analytics Embedded Components

This skill activates when a practitioner needs to embed a CRM Analytics dashboard into a Salesforce page (Lightning App Builder or Experience Cloud), or embed a custom LWC component inside an Analytics dashboard canvas. It covers component selection, attribute configuration, context passing via `record-id` and `state`, and the critical distinction between embedding a dashboard IN a page versus embedding a component INSIDE a dashboard.

---

## Before Starting

Gather this context before working on anything in this domain:

| Context | What to confirm |
|---|---|
| Target surface | Is the dashboard going on a Lightning record/app page (use `wave-wave-dashboard-lwc`) or an Experience Cloud page (use `wave-community-dashboard`)? Or are you embedding a custom LWC inside an Analytics dashboard (use `analytics__Dashboard` target in js-meta.xml)? These are entirely different setups. |
| Dashboard identifier | You must use either the 18-character dashboard ID (starts with `0FK`) as the `dashboard` attribute, OR the developer API name as `developer-name`. Never both — they are mutually exclusive. |
| Context record | If the dashboard should filter on the page's current record, you need the 18-character Salesforce record ID available (usually `{!recordId}` in App Builder). The `record-id` attribute passes this to the dashboard for dynamic filtering. |
| State requirement | If you need to pre-populate filters or selections, the `state` attribute accepts a JSON string. Invalid JSON causes silent failure — the dashboard loads without the intended filter state. |
| CRM Analytics license | The org must have CRM Analytics (formerly Einstein Analytics / Tableau CRM) licensed. `wave-wave-dashboard-lwc` is part of the Analytics component library, not a standard platform component. |

---

## Core Concepts

### Embedding Direction: Two Completely Different Patterns

There are two fundamentally distinct embedding scenarios that practitioners routinely confuse:

**Pattern A — Dashboard embedded IN a page**: You place a CRM Analytics dashboard onto a Lightning record page, Lightning app page, or Experience Cloud page. The host page is the container; the dashboard is the embedded content. You use `wave-wave-dashboard-lwc` (Lightning) or `wave-community-dashboard` (Experience Cloud).

**Pattern B — Custom LWC embedded INSIDE a dashboard**: You author a custom LWC in VS Code/CLI and declare it as an Analytics dashboard component via the `analytics__Dashboard` target in its `js-meta.xml`. The Analytics dashboard canvas is the container; your LWC is the embedded content. This pattern involves the LWC developer registering component attributes that appear as dashboard widget properties.

Mixing up these two patterns leads to broken setups. If a practitioner asks "how do I embed my LWC in a dashboard?" they mean Pattern B. If they ask "how do I show a dashboard on a record page?" they mean Pattern A. Confirm the direction before writing any code.

### Component Selection for Pattern A: Lightning vs Experience Cloud

For Pattern A, the component used depends strictly on the **page surface**, not on the dashboard type:

- **Lightning App Builder pages** (record pages, app pages, home pages): use `wave-wave-dashboard-lwc`
- **Experience Cloud pages** (community/portal pages built in Experience Builder): use `wave-community-dashboard`

These components are not interchangeable. Using `wave-community-dashboard` on a Lightning page causes the component to fail to render. Using `wave-wave-dashboard-lwc` on an Experience Cloud page is not supported and is not available in the Experience Builder component palette.

### Dashboard Attribute: `dashboard` vs `developer-name`

The `wave-wave-dashboard-lwc` component (and `wave-community-dashboard`) accepts two mutually exclusive identifiers:

- **`dashboard`**: The 18-character Salesforce record ID of the dashboard, beginning with `0FK`. This is the ID visible in the URL when you open the dashboard in Analytics Studio.
- **`developer-name`**: The API name of the dashboard as defined in the Analytics app. This is the human-readable string like `Account_Revenue_Overview`.

Setting both attributes causes a **silent fallback** — the component uses one and ignores the other without throwing an error. The `dashboard` (ID) attribute takes precedence when both are present. To avoid ambiguity and silent failures, always use exactly one of the two.

### Context Passing: `record-id` and `state`

**`record-id`**: Accepts the 18-character Salesforce record ID of the page's current record. In App Builder, bind it to `{!recordId}`. The dashboard must be designed to consume this value — it does not automatically filter unless the dashboard's dataset has a binding configured to use the passed record ID. The `record-id` attribute simply makes the ID available; the dashboard designer controls whether and how it is used.

**`state`**: Accepts a JSON string encoding filters and selections to apply when the dashboard loads. The format matches the Analytics Dashboard REST API state structure. Example: `{"myStep": {"selections": ["AccountA"]}}`. The string must be valid JSON. Invalid JSON causes silent failure — the dashboard renders in its default state with no indication that the state was rejected. When building the state string dynamically, always validate JSON before passing it.

---

## Common Patterns

### Pattern A1: Dashboard on a Lightning Record Page with Record Context

**When to use:** You want a CRM Analytics dashboard to appear on an Account, Opportunity, or other record page in Lightning and have it automatically scope to the current record.

**How it works:**

1. In App Builder, drag the "CRM Analytics Dashboard" component onto the record page layout.
2. Set the `Dashboard` property to the 18-character dashboard ID (0FK...) or the developer API name.
3. Set the `Record ID` property to `{!recordId}` — App Builder binds this to the current record's ID at runtime.
4. In the dashboard itself (built in Analytics Studio), configure a step or filter binding that references the passed `record-id` value.
5. Save and activate the page.

In markup (if building a wrapper LWC):

```html
<wave-wave-dashboard-lwc
    developer-name="Account_Revenue_Overview"
    record-id={recordId}
    show-sharing-button="false">
</wave-wave-dashboard-lwc>
```

**Why not iframe:** An iframe embedding loses the `record-id` context binding and action/selection callbacks. It also does not respond to App Builder property bindings.

### Pattern A2: Dashboard on an Experience Cloud Page

**When to use:** You are building an Experience Cloud portal or community and need a CRM Analytics dashboard visible to external users or partners.

**How it works:**

In Experience Builder, use the `wave-community-dashboard` component. The attribute surface is similar to `wave-wave-dashboard-lwc` but the component is registered for the Experience Cloud runtime.

```html
<wave-community-dashboard
    developer-name="Partner_Pipeline_Dashboard"
    show-title="true"
    show-sharing-button="false">
</wave-community-dashboard>
```

**Why not wave-wave-dashboard-lwc:** `wave-wave-dashboard-lwc` is not available in the Experience Builder component palette. Attempting to use it in an Experience Cloud page requires a custom LWC wrapper, which still must use `wave-community-dashboard` internally for Experience Cloud surfaces.

### Pattern B: Custom LWC Inside an Analytics Dashboard

**When to use:** You want a custom-built LWC to appear as a widget inside an Analytics dashboard canvas — for example, a custom action button, a specialized visualization, or a form component that writes back to Salesforce.

**How it works:**

1. Create the LWC with standard tooling (`sf generate component`).
2. In the component's `js-meta.xml`, add `analytics__Dashboard` to the `<targets>` block:

```xml
<targets>
    <target>analytics__Dashboard</target>
</targets>
```

3. Optionally expose `<targetConfig>` properties for the `analytics__Dashboard` target so dashboard designers can configure the component from the widget property panel.
4. Deploy the component to the org.
5. In Analytics Studio, open the dashboard in edit mode. The custom LWC appears in the widget picker under "Custom Components."
6. Drag it onto the canvas and configure exposed properties.

**Why not the embedding approach:** You cannot use `wave-wave-dashboard-lwc` inside an Analytics dashboard. The dashboard canvas requires components registered via `analytics__Dashboard` target, not standard Lightning page components.

---

## Decision Guidance

| Situation | Recommended Approach | Reason |
|---|---|---|
| Show a dashboard on a Lightning record/app/home page | `wave-wave-dashboard-lwc` | Only component supported in Lightning App Builder for this purpose |
| Show a dashboard on an Experience Cloud page | `wave-community-dashboard` | Required component for Experience Cloud surfaces; `wave-wave-dashboard-lwc` is not available there |
| Pass the current record's ID for dynamic filtering | `record-id` attribute on embedding component | Standard context-passing mechanism; binds to `{!recordId}` in App Builder |
| Pre-populate dashboard filters/selections on load | `state` attribute with valid JSON string | Encodes initial filter/selection state per Analytics Dashboard state schema |
| Add a custom LWC as a widget inside an Analytics dashboard | `analytics__Dashboard` target in `js-meta.xml` | Registers the LWC with the Analytics dashboard runtime so it appears in the widget picker |
| Identify dashboard by its API name instead of record ID | `developer-name` attribute | Portable across orgs and sandboxes; do not combine with `dashboard` attribute |
| Embed dashboard in a third-party or non-Salesforce page | iframe with dashboard public URL | Last resort: loses action bindings, context passing, and session-aware filtering |

---

## Recommended Workflow

Step-by-step instructions for an AI agent or practitioner working on this task:

1. **Confirm the embedding direction.** Ask: is a dashboard going INTO a page (Pattern A), or is a custom LWC going INSIDE a dashboard (Pattern B)? These require completely different implementations. Do not proceed until this is clear.
2. **For Pattern A, confirm the target surface.** Lightning App Builder pages require `wave-wave-dashboard-lwc`. Experience Cloud pages require `wave-community-dashboard`. Confirm the page type before writing any markup.
3. **Identify the dashboard reference.** Retrieve either the 18-character dashboard ID (0FK...) from Analytics Studio's URL, or the developer API name. Choose one — do not set both `dashboard` and `developer-name` on the same component.
4. **Configure context passing.** If the dashboard must scope to the current record, set `record-id` to the 18-char record ID (bind to `{!recordId}` in App Builder). If filters/selections must be pre-loaded, build a valid JSON string for the `state` attribute and validate it before use.
5. **For Pattern B, configure js-meta.xml.** Add `analytics__Dashboard` to the `<targets>` block. Define any `<targetConfig>` properties the dashboard designer will need. Deploy the LWC to the org.
6. **Verify the dashboard renders with expected context.** After deployment, open the page, confirm the dashboard loads, verify record-context filtering works as expected, and check browser console for silent state errors.
7. **Review the gotchas checklist** in `references/gotchas.md` — specifically the mutual-exclusivity rule for `dashboard`/`developer-name` and the JSON validity requirement for `state`.

---

## Review Checklist

Run through these before marking work in this area complete:

- [ ] Embedding direction confirmed: dashboard-in-page (Pattern A) or LWC-in-dashboard (Pattern B)
- [ ] Correct component selected for surface: `wave-wave-dashboard-lwc` for Lightning, `wave-community-dashboard` for Experience Cloud
- [ ] Only one of `dashboard` (0FK ID) or `developer-name` is set — never both
- [ ] `record-id` is bound correctly (`{!recordId}` in App Builder) if record-context filtering is required
- [ ] `state` attribute value is valid JSON — validated before deployment
- [ ] For Pattern B: `analytics__Dashboard` target is present in `js-meta.xml`
- [ ] Dashboard renders on target page and context filtering works as expected

---

## Salesforce-Specific Gotchas

Non-obvious platform behaviors that cause real production problems:

1. **`dashboard` and `developer-name` are mutually exclusive** — Setting both on `wave-wave-dashboard-lwc` does not throw an error. The component silently uses `dashboard` (the 18-char ID) and ignores `developer-name`. This causes hard-to-debug issues where a dashboard appears to work in one org but points to the wrong dashboard in another where IDs differ.
2. **`wave-wave-dashboard-lwc` vs `wave-community-dashboard` are NOT interchangeable** — `wave-wave-dashboard-lwc` is only available in the Lightning App Builder component palette. `wave-community-dashboard` is only available in Experience Builder. Using the wrong component on the wrong surface results in the component not appearing or rendering broken — with no clear error message.
3. **Invalid `state` JSON causes silent failure** — If the JSON string passed to `state` is malformed, the dashboard loads in its default state. There is no warning in the UI or console. Always validate JSON before passing it to `state`.
4. **`record-id` passes context but does not auto-filter** — Passing a record ID via `record-id` does not automatically scope the dashboard to that record. The dashboard must be designed with explicit bindings that consume the passed record ID. If the dashboard designer has not configured those bindings, the attribute is silently ignored.
5. **Pattern A and Pattern B share no setup steps** — Practitioners sometimes try to use `analytics__Dashboard` target in `js-meta.xml` to add a dashboard to a Lightning page, or try to drag `wave-wave-dashboard-lwc` into an Analytics dashboard canvas. Neither works. The target registration and the page component are for entirely separate embedding directions.

---

## Output Artifacts

| Artifact | Description |
|---|---|
| LWC markup with correct embedding component | `wave-wave-dashboard-lwc` or `wave-community-dashboard` with correct attribute configuration |
| `js-meta.xml` with `analytics__Dashboard` target | For Pattern B (custom LWC inside Analytics dashboard canvas) |
| Dashboard attribute configuration | Chosen dashboard reference (ID or developer-name), record-id binding, state JSON |
| Embedding decision rationale | Written explanation of why the chosen pattern and component are correct for the surface |

---

## Related Skills

- `admin/crm-analytics-app-creation` — for creating the CRM Analytics app and dashboard that will be embedded
- `admin/analytics-dashboard-design` — for designing the dashboard content, steps, and filters before embedding
- `architect/org-limits-monitoring` — if embedding dashboards that surface org limit data

Related Skills

lwc-web-components-interop

8
from PranavNagrecha/AwesomeSalesforceSkills

LWC interop with non-LWC web components: consuming third-party standard custom elements in LWC, exposing LWC as custom elements externally, Shadow DOM vs native web components, polyfills, and slotting patterns. NOT for LWC-to-LWC composition (use lwc-best-practices). NOT for Aura interop (use aura-to-lwc-migration).

lwc-dynamic-components

8
from PranavNagrecha/AwesomeSalesforceSkills

Dynamic LWC component creation using the `lwc:component` directive, lazy-loaded dynamic imports (`import()`), and runtime component resolution for conditional rendering at scale. Triggers: 'render different components based on record type', 'dynamically load lwc at runtime', 'lwc:component lwc:is constructor', 'lazy load component only when needed', 'dynamic import lwc'. NOT for static component composition or `lwc:if` conditional rendering when the component set is fixed at build time (use lwc-conditional-rendering).

experience-cloud-lwc-components

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when building custom LWC components for Experience Cloud (Experience Builder sites, LWR portals, Aura-based communities). Covers community context imports, guest user Apex access patterns, navigation API differences between LWR and Aura, and JS-meta.xml target configuration for Experience Builder exposure. NOT for internal LWC components deployed to Lightning App Builder or standard record pages (see lwc/lwc-development). NOT for Aura community components. Trigger keywords: build LWC for Experience Cloud, custom component community portal LWC, guest user LWC component, community context import salesforce, lightningCommunity target, @salesforce/community, guest Apex.

commerce-lwc-components

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when building or customizing Lightning Web Components for B2B Commerce or D2C LWR storefronts — product display tiles, cart line-item components, checkout step components, wishlist buttons, and product comparison widgets that rely on Commerce Storefront wire adapters from the commerce namespace. NOT for standard LWC development outside a Commerce store context, not for Aura-based Community Builder components, and not for legacy B2B Commerce (CloudCraze) Aura widgets.

flow-screen-lwc-components

8
from PranavNagrecha/AwesomeSalesforceSkills

Design custom Lightning Web Components that render inside Screen Flow steps — covers the lightning__FlowScreen target, @api properties as Flow inputs/outputs, FlowAttributeChangeEvent propagation, FlowNavigationNext/Back/Finish/Pause events, the @api validate() hook, and design-time targetConfig wiring. NOT for custom property editors that configure flow elements at design time — see flow-custom-property-editors. NOT for the LWC implementation deep-dive — see lwc/lwc-in-flow-screens.

flow-reactive-screen-components

8
from PranavNagrecha/AwesomeSalesforceSkills

Build reactive Flow screens where one component updates another without navigation using reactive formulas and component outputs. NOT for Aura-based screens.

einstein-analytics-data-model

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when working with CRM Analytics (Einstein Analytics) extended metadata (XMD) — the multi-layer metadata system that controls field display labels, aliases, number formatting, date formatting, measure/dimension classification, and color palettes on CRM Analytics datasets. Trigger keywords: XMD API, dataset field formatting CRM Analytics, wave dataset labels, main XMD update, dataset versioning Analytics. NOT for dataflow development, recipe node configuration, dataset ingestion setup, standard dashboard design, or SAQL query construction — those are covered by analytics-dataflow-development and analytics-recipe-design.

crm-analytics-security-predicates

8
from PranavNagrecha/AwesomeSalesforceSkills

Row-level security in CRM Analytics datasets via security predicates — SAQL filter expressions stored on the dataset that apply at query time per running user. Covers the syntax (`'DatasetColumn' operator value`), the `$User.*` context variables, multi-level predicates (role hierarchy + team + region), the performance cost of complex predicates, and the testing discipline (admins bypass predicates by default). NOT for Salesforce Core sharing rules (different runtime), NOT for App / Dashboard / Lens-level access (that's CRM Analytics App sharing, not predicates), NOT for field-level masking inside a dataset (use Encryption + dataset transformations).

community-analytics-data

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when analyzing Experience Cloud site analytics including login metrics, member engagement, page view tracking, and content performance. Triggers: Experience Cloud site analytics, community member engagement data, portal login tracking, page view reports community, GA4 Experience Cloud integration. NOT for CRM Analytics or Tableau CRM. NOT for internal Salesforce reporting on standard CRM objects.

commerce-analytics-data

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when analyzing B2C Commerce storefront metrics (conversion funnel, cart abandonment, product performance, revenue trends) via the Business Manager Reports and Dashboards app, or when deriving B2B Commerce analytics via SOQL on core platform objects or the CRM Analytics B2B Commerce template. NOT for CRM Analytics platform configuration, Einstein Analytics, Experience Cloud analytics, or general Salesforce report builder usage.

analytics-external-data

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when bringing non-Salesforce data into CRM Analytics via the External Data API, Data Connectors, or Live Datasets. Trigger keywords: InsightsExternalData, External Data API, live dataset, remote connection, Snowflake connector, BigQuery connector, Tableau Bridge, external CSV upload, analytics connector. NOT for standard data import into Salesforce objects. NOT for Salesforce object sync via dataflow local connectors. NOT for standard ETL into Sales or Service Cloud.

analytics-dataset-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when tuning CRM Analytics dataset performance through field selection, date granularity choices, dataset splitting strategy, and run-budget optimization. Trigger keywords: dataset too many fields, SAQL timeseries slow, epoch vs date storage, dataset field count limit, dataset partition, split dataset by year, CRM Analytics performance tuning. NOT for SOQL optimization, Salesforce report tuning, Data Cloud segmentation performance, or choosing between analytics tools.