Analytics Embedding SDK
Use the Analytics Embedding SDK to embed Tableau Next analytical components in any web page. This SDK supports typescript, javascript and HTML formats. This version of the SDK is compatible with Salesforce API v65.0 and above.
Note: The orgUrl parameter must be the Lightning URL (e.g., https://yourorg.lightning.force.com), not the my.salesforce.com domain URL.
You can pass an optional customViewId so the embedded dashboard opens with the
same saved filter state (custom view) as in Tableau Next. This aligns with share
links that include a customViewId query parameter, and helps preserve dashboard
interactivity when embedding in other surfaces (for example Slack).
TypeScript / JavaScript — set customViewId on the dashboard props (or assign
dashboard.customViewId after construction):
HTML — use the custom-view-id attribute on <analytics-dashboard>:
If your app parses a dashboard URL, read the customViewId query parameter and pass it
through as shown above.
Configure actions on the dashboard in Tableau Next using Salesforce Help: add actions to a dashboard.
Dashboard actions (buttons configured on the dashboard) are supported in third-party embedding. That includes actions such as Salesforce Flows, page navigation, and URL navigation, consistent with the embedded dashboard experience in Tableau Next.
The AnalyticsAgent component embeds your Analytics and Visualization agent powered by Agentforce. It helps users understand data through natural language insights, visualizations, and proactive alerts.
The agent supports two operating modes:
- Single-context mode — Provide
contextConfigto bind the agent to a specific dashboard, metric, or semantic model. - Multi-component mode — Omit
contextConfigto automatically track all embeddedAnalyticsDashboardandAnalyticsMetriccomponents on the page.
The AgentContextType enum specifies the type of analytics asset to bind the agent to:
| Value | Description |
|---|---|
AgentContextType.DASHBOARD | Dashboard context |
AgentContextType.METRIC | Metric context |
AgentContextType.SDM | Semantic Model context |
Use the styleTokens property to theme the agent UI:
Call startNewAgentSession() to programmatically restart the conversation:
The SDK supports embedding components from multiple Salesforce orgs in a single application. Use orgConfigs instead of a single orgUrl and authCredential:
Note:
- The
orgUrlis required when creating components in a multi-org scenario, to ensure your component connects to the correct org.
You can add new orgs or retry failed orgs after initial SDK initialization using retryOrAddOrgs:
The retryOrAddOrgs function returns the same BootstrapResponse format as initializeAnalyticsSdk.
The initializeAnalyticsSdk function returns a BootstrapResponse object:
Sample response:
Status values:
Status.SUCCESS- All orgs initialized successfullyStatus.PARTIAL_SUCCESS- Some orgs initialized successfully (multi-org only)Status.FAILURE- Initialization failed
For a single org or multiple orgs, Salesforce may require an extra step before the session is valid—such as multi-factor authentication (MFA) or a forced password reset. In that case initializeAnalyticsSdk can return a non-success overall status while the affected org appears in response.orgStates with:
state:AUTH_REDIRECT(seeOrgStates.AUTH_REDIRECTwhen importing the enum)redirectUrl: org-provided path (often relative)redirectOrigin: origin to combine withredirectUrl
What to do
- For each org entry in
AUTH_REDIRECT, send the user to the challenge UI, typically by opening${redirectOrigin}${redirectUrl}in a new window or tab (popups may be blocked; fall back to a full tab). - After the user finishes MFA or password reset and the browser session is established for that org, resume the SDK by calling
retryOrAddOrgsfor that org.
Credentials when retrying
- Normal retry: pass a fresh frontdoor URL (or equivalent session credential) as
authCredentialtogether with the same LightningorgUrl. - After MFA / password reset: once the session exists in the browser, you can retry with the Lightning org URL as the credential:
{ orgUrl, authCredential: orgUrl }, without generating a new frontdoor URL first. If that retry does not succeed, obtain a new frontdoor URL and retry with it.
The retryOrAddOrgs response uses the same BootstrapResponse shape as initializeAnalyticsSdk, so you can inspect orgStates again for any remaining AUTH_REDIRECT or errors.
The SDK provides a logout function to log out from Salesforce orgs. The function returns a LogoutResponse with the same structure as BootstrapResponse.
Sample response:
The SDK supports all browsers supported in Salesforce Lightning Experience.