embedded-analytics-architecture
Use this skill to architect CRM Analytics dashboard embedding in Lightning pages, Experience Cloud, or Visualforce — covering dashboard context strategy, filter/state management, cross-dashboard context propagation, performance optimization, and LWC vs Aura component selection. Trigger keywords: embed CRM Analytics dashboard, embedded analytics Lightning page, analytics dashboard filter, wave dashboard LWC, analytics state attribute. NOT for CRM Analytics dashboard design/building (use analytics skills), standard Lightning report embedding, or Data Cloud analytics.
Best use case
embedded-analytics-architecture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use this skill to architect CRM Analytics dashboard embedding in Lightning pages, Experience Cloud, or Visualforce — covering dashboard context strategy, filter/state management, cross-dashboard context propagation, performance optimization, and LWC vs Aura component selection. Trigger keywords: embed CRM Analytics dashboard, embedded analytics Lightning page, analytics dashboard filter, wave dashboard LWC, analytics state attribute. NOT for CRM Analytics dashboard design/building (use analytics skills), standard Lightning report embedding, or Data Cloud analytics.
Teams using embedded-analytics-architecture 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/embedded-analytics-architecture/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How embedded-analytics-architecture Compares
| Feature / Agent | embedded-analytics-architecture | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use this skill to architect CRM Analytics dashboard embedding in Lightning pages, Experience Cloud, or Visualforce — covering dashboard context strategy, filter/state management, cross-dashboard context propagation, performance optimization, and LWC vs Aura component selection. Trigger keywords: embed CRM Analytics dashboard, embedded analytics Lightning page, analytics dashboard filter, wave dashboard LWC, analytics state attribute. NOT for CRM Analytics dashboard design/building (use analytics skills), standard Lightning report embedding, or Data Cloud analytics.
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
# Embedded Analytics Architecture
This skill activates when an architect needs to design the strategy for embedding CRM Analytics dashboards in Lightning Experience, Experience Cloud, or Visualforce — including dashboard context wiring, filter state management, cross-component context propagation, and performance optimization. It produces architecture decisions and configuration specs that developers use to implement embedded analytics correctly.
---
## Before Starting
Gather this context before working on anything in this domain:
- Confirm the target embedding context: Lightning record page (most common), Lightning App page, Experience Cloud authenticated page, Experience Cloud guest page, or Visualforce. Each context has different component availability and permission requirements.
- The LWC `wave-wave-dashboard` component (Spring '25+) and the Aura `wave:waveDashboard` component have fundamentally different filtering APIs — the `state` attribute in LWC replaces the full dashboard state as a JSON object, while the `filter` attribute in the legacy Aura component adds incremental filter selections. Using the wrong filtering approach produces silent failures.
- Dashboard state is a structured JSON object managed via `getState()`/`setState()` component methods — it enables cross-dashboard context propagation and dynamic filter updates without full re-renders.
- The most critical gotcha: hard-coding a `dashboardDevName` attribute breaks when dashboards are promoted across sandboxes or renamed. Always resolve `dashboardDevName` at runtime using an Apex method or a Custom Setting.
---
## Core Concepts
### LWC vs Aura Component Selection
Two component options for embedding CRM Analytics dashboards:
**LWC `wave-wave-dashboard` (recommended for Lightning Experience):**
- Uses `state` attribute — a full JSON object that replaces the entire dashboard state
- `record-id` attribute automatically passes the current Lightning record context
- `dashboardDevName` attribute (preferred) or `dashboardId` (18-char 0FK ID)
- Works in Lightning Experience and Experience Cloud (authenticated pages)
**Aura `wave:waveDashboard` (legacy, Visualforce pages only):**
- Uses `filter` attribute — adds incremental selection filters on top of existing state
- Different syntax than LWC `state` — cannot use Filter and Selection Syntax JSON in LWC's `state` attribute as-is
- Still required for Visualforce embedding contexts
**Mixing these up is the most common embedded analytics mistake.** Using the `filter` attribute against the LWC component silently has no effect; the `state` attribute must be used.
### Dashboard State and Filter Architecture
The `state` attribute in the LWC component is a JSON object matching the Filter and Selection Syntax spec:
```json
{
"filters": [
{
"field": "Opportunity.OwnerId",
"operator": "in",
"value": ["005xxxxxxxxxxxx"]
}
]
}
```
State management patterns:
- **Record-context filter** — `record-id` attribute passes the current Salesforce record ID to the dashboard; the dashboard must have a binding that uses the record ID as a filter
- **Dynamic state via JavaScript** — get and set `state` via the LWC component's `getState()`/`setState()` API to update filters without re-rendering the full dashboard
- **Cross-dashboard propagation** — a selection event in Dashboard A can be caught in the parent LWC and used to update the `state` attribute of Dashboard B
### dashboardDevName Runtime Resolution
Hard-coding `dashboardDevName` causes failures when:
- The dashboard is renamed in any org
- The dashboard is deployed with a different developer name in sandbox vs production
- Multiple dashboards serve different audiences and the selection is user-context-dependent
Architecture pattern: store dashboard dev names in a Custom Setting or Custom Metadata Type; retrieve them in Apex and pass to the embedding component. Never hard-code in Lightning component markup.
---
## Common Patterns
### Pattern: Record-Context Embedded Dashboard
**When to use:** When a dashboard on a Lightning record page should automatically filter to the current record's data (e.g., Account dashboard showing that account's opportunities).
**How it works:**
1. Use LWC `wave-wave-dashboard` with `record-id="{recordId}"` binding
2. In the dashboard, create a binding that uses the record ID as a filter parameter
3. Test that the `record-id` value flows through to the dashboard binding correctly
4. Do NOT hard-code the dashboard ID — use `dashboardDevName` resolved from metadata
### Pattern: Cross-Dashboard Context Propagation
**When to use:** When a selection in one embedded dashboard should update the view in an adjacent embedded dashboard on the same page.
**How it works:**
1. Add a selection event listener on Dashboard A's LWC component wrapper
2. Catch the selection event in the parent Lightning Web Component
3. Build the updated `state` JSON from the selection value
4. Call `setState()` on Dashboard B's LWC component reference to update its filters without full re-render
---
## Decision Guidance
| Situation | Recommended Approach | Reason |
|---|---|---|
| Lightning record page embedding | LWC wave-wave-dashboard, record-id attribute | Native record context; best performance |
| Visualforce embedding | Aura wave:waveDashboard | LWC wave-wave-dashboard not available in Visualforce |
| Multiple dashboards on one page sharing context | JavaScript getState/setState cross-component | Avoids full re-render; maintains filter state across dashboards |
| Dashboard dev name varies by environment | Store in Custom Metadata, resolve at runtime | Hard-coded dev names break on rename or cross-env promotion |
| Experience Cloud guest user access to analytics | Confirm Guest User profile analytics permission | Guest users require explicit analytics permission and dashboard sharing |
| Filtering based on current user attributes | $User.Id or $UserAttribute binding in dashboard | Do not pass user attributes via URL parameters — security risk |
---
## Recommended Workflow
Step-by-step instructions for an AI agent or practitioner working on this task:
1. Determine the embedding context (Lightning record page, App page, Experience Cloud, Visualforce) and select the appropriate component (LWC for Lightning/Experience Cloud, Aura for Visualforce).
2. Confirm the dashboard developer name is not hard-coded — design a runtime resolution mechanism (Custom Metadata or Apex) to retrieve it.
3. Design the filter/state strategy: identify what record or user context should be passed as dashboard filters; specify the `state` JSON structure for each filter.
4. Identify any cross-dashboard context propagation requirements: design the event listener and setState pattern for updating adjacent dashboards on selection events.
5. Plan the Experience Cloud permission model if applicable: confirm Guest User profile has analytics access and the dashboard is shared to the correct community profile.
6. Performance planning: specify whether the dashboard should load eagerly or lazily (defer load until user scrolls to the component); identify any heavy datasets that should be pre-filtered before embedding.
7. Document the architecture decision record: component choice, state management approach, dev name resolution strategy, and permission model.
---
## Review Checklist
Run through these before marking work in this area complete:
- [ ] Component type chosen (LWC wave-wave-dashboard vs Aura wave:waveDashboard) with rationale
- [ ] dashboardDevName resolved at runtime — not hard-coded
- [ ] Filter/state JSON schema documented for each embedded dashboard
- [ ] record-id binding confirmed for record-page contexts
- [ ] Cross-dashboard context propagation design documented if applicable
- [ ] Experience Cloud guest user permissions verified if applicable
- [ ] Performance strategy specified (eager vs lazy load)
---
## Salesforce-Specific Gotchas
Non-obvious platform behaviors that cause real production problems:
1. **Using `filter` attribute syntax on the LWC component silently has no effect** — The `filter` attribute is a legacy Aura `wave:waveDashboard` property. Using it on the LWC `wave-wave-dashboard` component silently does nothing — no error, no filter applied. The correct LWC attribute is `state`, which takes a JSON object using the Filter and Selection Syntax spec. This is the single most common embedded analytics configuration mistake.
2. **Hard-coded `dashboardDevName` breaks on rename or cross-env promotion** — If a dashboard is renamed in any org, or if the developer name differs between sandbox and production, the embedding component silently shows a "dashboard not found" error or renders nothing. Architecture must include a runtime dev name resolution mechanism.
3. **Dashboard state from `getState()` may return null after Salesforce maintenance** — The Replay ID mechanism for Platform Events (analogous issue exists with dashboard state) can be stale after org maintenance. For embedded dashboards, the state should be treated as ephemeral and the embedding component should initialize state fresh from application context on each page load rather than relying on cached state.
---
## Output Artifacts
| Artifact | Description |
|---|---|
| Embedded analytics architecture decision record | Component choice, state management approach, dev name resolution, permission model |
| Dashboard state JSON schema | Filter and Selection Syntax JSON structure for each embedded dashboard |
| LWC embedding configuration spec | Attribute bindings, event listeners, setState call patterns |
---
## Related Skills
- `admin/analytics-requirements-gathering` — upstream requirements skill for CRM Analytics data source and audience needs
- `admin/analytics-kpi-definition` — KPI definition skill upstream of dashboard design
- `architect/platform-selection-guidance` — broader platform selection guidanceRelated Skills
salesforce-files-architecture
Working with Salesforce Files at the data layer — `ContentVersion` (the binary content + version metadata), `ContentDocument` (the parent / shareable handle), `ContentDocumentLink` (the sharing / parent-record join), the 2 GB single-file size limit and the 10 MB feed-attached limit, the deprecated `Attachment` object, the `Document` object (Classic-only), and Files Connect for external file sources. Covers SOQL patterns to enumerate files attached to a record, Apex insert / link patterns, sharing implications of `ShareType` and `Visibility`, and the migration path from the legacy Attachment object. NOT for LWC file upload UI components (see lwc/lwc-file-upload-patterns), NOT for static-resource bundling (see lwc/static-resources).
nonprofit-data-architecture
Use this skill when designing or querying the NPSP data model — constituent 360, household accounts, giving history rollups, and program participation. Trigger keywords: NPSP data model, household account, constituent record, giving rollups, CRLP, program engagement, ServiceDelivery, npo02__ fields. NOT for standard data model design, Nonprofit Cloud (NPC) data model, FSC household groups, or platform data modeling outside the NPSP context.
einstein-analytics-data-model
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
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
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
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
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
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.
analytics-data-preparation
Use this skill when customizing CRM Analytics dataset field metadata via the XMD (Extended Metadata) REST API or augmenting CRM Analytics recipes with external non-Salesforce data: labeling fields, setting display formats, reclassifying measures vs dimensions, and applying org-level field annotations via main XMD PATCH. Trigger keywords: XMD field labels, CRM Analytics main XMD update, dataset field formatting wave, analytics external data augmentation, WaveXmd REST API. NOT for recipe node transformation logic, dataflow SOQL extraction, dataset row count management, or standard CRM data quality — those are covered by analytics-recipe-design, analytics-dataflow-development, and analytics-dataset-management.
wealth-management-architecture
Use this skill when designing or reviewing a Salesforce Financial Services Cloud (FSC) wealth management platform — covering advisor workspace configuration, client portal setup, portfolio data integration, Compliant Data Sharing, and FSC feature enablement decisions. NOT for investment product advice, financial planning calculations, or FSC Health Cloud configurations.
subscription-management-architecture
Use when designing or evaluating Salesforce CPQ subscription lifecycle architecture: amendment flow, renewal automation, co-termination design, or billing integration at the contract level. Trigger keywords: amendment architecture, renewal automation, co-termination design, subscription ledger, large-scale amendment, billing schedule, swap pattern, SBQQ__Subscription__c. NOT for billing setup, standard Salesforce contracts without CPQ, or Revenue Cloud advanced order management.
service-cloud-architecture
Use when designing a Service Cloud solution end-to-end: channel strategy (phone, email, chat, messaging, social), routing model (queue-based vs skills-based Omni-Channel), knowledge strategy, entitlement and SLA enforcement, Einstein Bot / Agentforce deflection, and integration points. Triggers: service cloud architecture, case routing design, omni-channel strategy, contact center design, channel strategy, knowledge deflection, service console architecture. NOT for individual feature configuration (use admin/case-management), NOT for Einstein Bot conversation design (use agentforce/einstein-bot-architecture), NOT for telephony CTI implementation details.