Class: AnalyticsAgent
A web component for embedding an Analytics and Visualization agent.
The AnalyticsAgent helps users see and understand data with conversational analytics.
It generates natural language insights, visualizations, and proactive alerts in your flow of work.
The agent supports two operating modes:
- Single-context mode: Provide
contextConfiginAgentPropsto track a single analytics asset (dashboard, metric, or semantic model). - Multi-component mode: Omit
contextConfigto automatically track all embeddedAnalyticsDashboardandAnalyticsMetriccomponents on the page.
Use AgentStyleTokens to theme the agent UI to match your application's look and feel.
AnalyticsComponent
new AnalyticsAgent(
props):AnalyticsAgent
The constructor for AnalyticsAgent.
• props: AgentProps
The initialization properties for the agent component.
In multi-org scenarios, always specify the orgUrl parameter when creating components:
Note: The orgUrl parameter must be a Lightning URL (e.g., https://yourorg.lightning.force.com), not the my.salesforce.com domain URL. All methods of the component operate on the org specified by this orgUrl.
AnalyticsComponent.constructor
parentIdOrElement:
string|HTMLElement
This ID of the container or the container where the analytics component is embedded.
AnalyticsComponent.parentIdOrElement
getcomponentType():string
Returns the component type: agent.
string
AnalyticsComponent.componentType
getheight():string
The height for the component, in CSS units. Acceptable string formats include:
- Pixel values (e.g., "800px")
- Percentages (e.g., "100%")
- Relative units (e.g., "2rem", "1.5em")
- Other valid CSS height values.
If an invalid value is provided, the value defaults to 100%.
setheight(val):void
• val: string
string
- Returns the height of the component.
AnalyticsComponent.height
getidOrApiName():string
The ID or API name used to identify the Tableau Next component.
setidOrApiName(val):void
• val: string
string
- Returns the ID or API name of the component to embed.
AnalyticsComponent.idOrApiName
getorgUrl():undefined|string
The org URL for the component.
Multi-org Note: In multi-org scenarios, this property identifies which org the component belongs to. Returns a Lightning URL (e.g., https://yourorg.lightning.force.com).
setorgUrl(val):void
• val: string
undefined | string
The org URL, or undefined if not set.
AnalyticsComponent.orgUrl
getwidth():string
The width for the component, in CSS units. Acceptable string formats include:
- Pixel values (e.g., "800px")
- Percentages (e.g., "100%")
- Relative units (e.g., "2rem", "1.5em")
- Other valid CSS width values.
If an invalid value is provided, the value defaults to 100%.
setwidth(val):void
• val: string
string
- Returns the width of the component.
AnalyticsComponent.width
reload():
Promise<void>
Reloads the component to retrieve the latest data from the server.
Promise<void>
- A promise that resolves when reload is complete.
AnalyticsComponent.reload
render():
Promise<string>
Renders the component by appending it to the specified parent element.
Promise<string>
A promise that resolves when the component is loaded successfully, or rejects with an error message if the loading fails.
AnalyticsComponent.render
startNewAgentSession():
Promise<void>
Starts a new session for the agent, clearing the current session history. This is useful for resetting the agent context when the user navigates to a different part of your application.
Promise<void>
A promise that resolves when a new session is created.