Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

docs - embed js edits (#62526)

Jeff Bruemmereb3499678d66
diff --git a/docs/developers-guide/community-drivers.md b/docs/developers-guide/community-drivers.md
index 8255fa72b62..cb25fb14503 100644
--- a/docs/developers-guide/community-drivers.md
+++ b/docs/developers-guide/community-drivers.md
@@ -18,7 +18,7 @@ To use a Community driver on a self-hosted Metabase:
1. Download the latest JAR file from the driver's repository (see the repo's Releases section for the JAR files).
2. Copy the JAR file into the plugins directory in your Metabase directory (the directory where you run the Metabase JAR).
-You can change the location of the plugins directory by setting the environment variable [`MB_PLUGINS_DIR`](../configuring-metabase/environment-variables#mb_plugins_dir).
+You can change the location of the plugins directory by setting the environment variable [`MB_PLUGINS_DIR`](../configuring-metabase/environment-variables.md#mb_plugins_dir).
## Community drivers
diff --git a/docs/embedding/embedded-analytics-js.md b/docs/embedding/embedded-analytics-js.md
index ced97fec873..ff34f496ca5 100644
--- a/docs/embedding/embedded-analytics-js.md
+++ b/docs/embedding/embedded-analytics-js.md
@@ -7,7 +7,7 @@ summary: Getting started with Embedded Analytics JS for embedding Metabase entit
{% include plans-blockquote.html feature="Embedded analytics JS" convert_pro_link_to_embbedding=true %}
-Embedded analytics JS allows you to embed Metabase entities like questions, dashboards, or even the query builder into your own application using customizable components.
+Embedded analytics JS lets you embed Metabase entities like questions, dashboards, or even the query builder into your own application using customizable components.
Embedded Analytics JS is a JavaScript library built on top of Metabase's [Embedded Analytics React SDK](./sdk/introduction.md). But it does not require using React or setting up full SDK embedding.
Unlike with [interactive embedding](./interactive-embedding.md), where you embed the entire Metabase app in an iframe, Embedded Analytics JS lets you choose from a set of predefined components like a single chart, a dashboard with optional drill-through, or query builder, and customize those components.
@@ -34,15 +34,15 @@ Currently you can choose to embed:
2. Choose the type of entity to embed. Currently the available types are dashboard, question, and exploration (which will embed the Metabase query builder).
3. Next, select the entity you want to embed.
-Once you selected what you want to embed, click Next to customize your embed.
+Once you've selected what you want to embed, click Next to customize your embed.
### 3. Customize your embed
-The exact customization options you see will depend on what type of entity you're embedding. You will see live preview of how the embed will look with your chosen options. See [Customizing embeds](#customizing-embeds) for more information on customization options.
+The exact customization options you see will depend on what type of entity you're embedding. You'll see a live preview of how the embed will look with your chosen options. Check out [Customizing embeds](#customizing-embeds) for more details on customization options.
![Customizing embeds](./images/embed-flow-options.png)
-You'll also be be able to pick brand, text, and background color used for all your embeds. To configure other colors (e.g. secondary colors, query builder colors etc), as well as font, you' can specify a theme in your embed code snippet, see [Theming](#theming).
+You'll also be be able to pick brand, text, and background color used for all your embeds. To configure other colors (e.g. secondary colors, query builder colors etc), as well as font, you' can specify a [theme](#theming) in your embed code snippet.
All the customization options you select in this interactive flow will be reflected in the parameter values in the embed code, so you'll be able to adjust them later by editing the embed snippet.
@@ -85,7 +85,7 @@ Here's an example of a script:
<!-- Embedding configuration -->
<script>
defineMetabaseConfig({
- instanceUrl: "https://your-metabase-url,
+ instanceUrl: "https://your-metabase-url",
theme: {
colors: {
background: "#ffffff",
@@ -104,41 +104,41 @@ Note the `defer` attribute and the reference to your Metabase URL in the script
If you're embedding multiple entities on the same page, you only need to include the `<script>` tags once globally.
-The code snipped for Embedded Analytics JS can also be generated interactively in Metabase through **+ New > Embed**, see [Quickstart](#quickstart).
+You can also generate the code snippet for Embedded Analytics JS interactively in Metabase through **+ New > Embed**. Check out the [Quickstart](#quickstart).
## Customizing embeds
The exact customization options you see will depend on what type of entity you're embedding.
-When you're creating a new embed using **+ New > Embed**, you'll see customization the following options in the interactive creating flow. These options correspond to parameters in components, see [Components](#components).
+When you're creating a new embed using **+ New > Embed**, you'll see the following customization options in the interactive creation flow. These options correspond to parameters in [components](#components).
-- **Allow users to drill through on data points**: determines whether users can interact with the chart (or charts on a dashboard). This includes drilling down to individual records from aggregated questions, filtering on click, zooming in, etc, see [Drill-through](/learn/metabase-basics/querying-and-dashboards/questions/drill-through). Disabling this option for an embedded _question_ will also disable people's ability to add filters and summaries.
+- **Allow people to drill through on data points**: determines whether people can interact with the chart (or charts on a dashboard). Interactivity includes [drilling down](https://www.metabase.com/learn/metabase-basics/querying-and-dashboards/questions/drill-through) to individual records from aggregated questions, filtering on click, zooming in, etc. Disabling drill-through for an embedded _question_ also disables people's ability to add filters and summaries.
-- **Allow downloads**: determines whether people can download the results of questions and save the dashboard as a PDF.
+- **Allow downloads**: determines whether people can download question results and save dashboards as PDFs.
-- **Allow users to save new questions**: disabling this will disallow people from saving new questions. In particular, when embedding the query builder, this means that while people will be able to build their own explorations, they won't be able to save them.
+- **Allow people to save new questions**. If you embed the query builder but disable this option, people can still do their own explorations, they just won't be able to save them.
-- **Parameters**: for dashboard filters, SQL variables, and time grouping parameters, you can add default values. The default value you add to this option will override the default values for the parameter specified at the dashboard/question level. For dashboard filters and parameters, you can choose whether the parameter should be hidden from people viewing the dashboard.
+- **Parameters**: for dashboard filters, SQL variables, and time grouping parameters, you can add default values. Default values set here override the default values set at the dashboard or question level. For dashboard filters and parameters, you can choose whether to hide the parameter.
- **Show title**: what it says on the tin.
## Configuring embeds
-You can use the `defineMetabaseConfig()` function to define the configuration that applies to every embed in the page. The function `defineMetabaseConfig()` accepts the following parameters:
+To define the configuration that applies to every embed on the page, use the `defineMetabaseConfig()` function. Its parameters include:
-- `instanceUrl: "https://your-metabase-url"` (required): the URL of your Metabase instance, e.g. https://youlooknicetoday.metabaseapp.com
+- `instanceUrl: "https://your-metabase-url"` (required): the URL of your Metabase instance, like https://youlooknicetoday.metabaseapp.com
-- `theme: {...}` (optional): appearance options for the embeds, see [Theming](#theming).
+- `theme: {...}` (optional): [appearance options for the embeds](#theming).
-- `useExistingUserSession: true|false` (optional, for development only) - allows you to preview the embed locally by using your Metabase's admin user account session. Only supported in Google Chrome.
+- `useExistingUserSession: true|false` (optional, for development only) - lets you preview the embed locally using your Metabase admin account session. Only supported in Google Chrome.
-- `apiKey: mb_YourAPIKey` (optional, for development only) - alternative way of previewing the embeds locally using the API key.
+- `apiKey: mb_YourAPIKey` (optional, for development only) - another way to preview embeds locally using an API key.
### Theming
-You can specify colors, fonts, configure spacing and other appearance options using the `theme` parameter of the embed configuration.
+You can specify colors, fonts, spacing, and other appearance options using the `theme` parameter in your embed configuration.
-For example, this will define the font, color, and size for text, color for backgrounds, and colors for filters and summaries:
+For example, this code defines the font, color, and size for text, background colors, and colors for filters and summaries:
```html
<script>
@@ -159,17 +159,17 @@ For example, this will define the font, color, and size for text, color for back
</script>
```
-For the full list of theme settings, see [Appearance](./sdk/appearance.md).
+See [appearance](./sdk/appearance.md).
## Authentication
### Use existing user session to test embeds
-> Existing sessions can only be used for testing embeds locally. To make your embeds production-ready, you will need to implement SSO.
+> Existing sessions can only be used for testing embeds locally. To make your embeds production-ready, you'll need to implement SSO.
-If you are signed into Metabase, you can leverage that existing session cookie to preview and test the embeds. This will only work in the same browser as you're using for your Metabase session.
+If you're signed into Metabase, you can use that existing session cookie to preview and test your embeds. This only works in the same browser (we recommend Chrome) you're using for your Metabase session (so it won't work in Incognito mode).
-To use the add `useExistingUserSession: true` to `defineMetabaseConfig()` in your embed code, see [Configuring embeds](#configuring-embeds).
+Add `useExistingUserSession: true` to `defineMetabaseConfig()` in your embed code. Check out [Configuring embeds](#configuring-embeds).
```html
<script>
@@ -184,7 +184,7 @@ Note that this will not work in some browsers, or in incognito mode. We recommen
### Use API keys to test embeds
-> API keys can only be used for testing embeds locally. To make your embeds production-ready or deploy them to another domain, you will need to implement SSO.
+> API keys can only be used for testing embeds locally. To make your embeds production-ready or deploy them to another domain, you'll need to implement SSO.
To use an API key to test your embeds:
@@ -200,17 +200,17 @@ To use an API key to test your embeds:
</script>
```
-Keep in mind that API keys should only be used for testing with trusted users. Anyone with access to the front-end can grab the API key and use it to make requests against the Metabase API. For this reason, we only allow using API keys on localhost.
+API keys should only be used for testing with trusted people. Anyone with access to the front-end can grab the API key and use it to make requests against the Metabase API. For this reason, we only allow using API keys on localhost.
### Set up SSO
-SSO is required to embed in a domain other than localhost. You can use JWT or SAML SSO. To configure SAML, see [Authenticating with SAML](./sdk/authentication#authenticating-with-saml-sso). To configure JWT, see the steps below.
+SSO is required to embed in a domain other than localhost. You can use JWT or SAML SSO. To configure SAML, check out [Authenticating with SAML](./sdk/authentication.md#authenticating-with-saml-sso). To configure JWT, follow the steps below.
#### 1. In Metabase, configure [JWT SSO](../people-and-groups/authenticating-with-jwt.md).
#### 2. In your app's backend, add a new endpoint to handle authentication.
-You’ll need add a library to your backend to sign your JSON Web Tokens.
+You'll need to add a library to your backend to sign your JSON Web Tokens.
For Node.js, we recommend jsonwebtoken:
@@ -218,7 +218,7 @@ For Node.js, we recommend jsonwebtoken:
npm install jsonwebtoken --save
```
-Next, set up an endpoint on your backend (e.g., `/sso/metabase`) that uses your Metabase JWT shared secret to generate a JWT for the authenticated user. **This endpoint must return a JSON object with a `jwt` property containing the signed JWT.** For example: `{ "jwt": "your-signed-jwt" }`.
+Next, set up an endpoint on your backend (like `/sso/metabase`) that uses your Metabase JWT shared secret to generate a JWT for the authenticated person. **This endpoint must return a JSON object with a `jwt` property containing the signed JWT.** For example: `{ "jwt": "your-signed-jwt" }`.
This example code for Node.js sets up an endpoint using Express:
@@ -238,7 +238,7 @@ const METABASE_JWT_SHARED_SECRET = "YOUR_SECRET_HERE";
const app = express();
app.get("/sso/metabase", async (req, res) => {
- // Usually, you would grab the user from the current session
+ // Usually, you'd grab the user from the current session
// Here it's hardcoded for demonstration purposes
// Example:
// const { user } = req.session;
@@ -278,33 +278,33 @@ See more examples in the [Embedding SDK docs](./sdk/authentication.md#2-add-a-ne
#### 3. Embeds will use SSO automatically by default
-Metabase will use JWT SSO by default if no other auth method is specified. Make sure you don't use `apiKey` or `useExistingUserSession` in your configuration to enable SSO use.
+By default, Metabase uses JWT SSO, but you can specify another auth method. To turn on SSO, make sure you _don't_ set your configuration to `apiKey` or `useExistingUserSession`.
## Components
There are different components available that enable different experiences for the end-user.
-> While you can use some component parameters to show or hide part of the embedded component, these parameters are not a substitute for setting up to prevent unwanted access to data or collections. Use these options as a way to streamline the user experience. Users could obtain their token from the front-end and use it to query the Metabase API.
+> While you can use component parameters to show or hide parts of the embedded component, these parameters are _not_ a substitute for [permissions](../permissions/start.md). Even if you hide stuff, people could still grab their token from the frontend and use it to query the Metabase API.
### Dashboard
+To render a dashboard:
+
```html
<metabase-dashboard dashboard-id="1" with-title="true" with-downloads="false">
</metabase-dashboard>
```
-Renders a dashboard.
-
**Required parameters:**
-- `dashboard-id` - This can be a regular ID or an entity ID. [Using Entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) in your embeds will ensure sure that the IDs are stable when exporting from one Metabase and importing to another Metabase.
+- `dashboard-id` - This can be a regular ID or an entity ID. [Using Entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) in your embeds ensures that the IDs stay stable when exporting from one Metabase and importing to another.
**Optional parameters:**
-- `with-title` (default is true) - show dashboard title in the embed
-- `with-downloads` (default is false) - show the button to download dashboard as PDF, and download results of questions
-- `drills` (default is true) - lets you drill-through the dashboard
-- `initial-parameters` - default value for dashboard filters, e.g. `{ 'productId': '42' }`.
+- `with-title` (default is true) - show the dashboard title in the embed
+- `with-downloads` (default is false) - show the button to download the dashboard as PDF and download question results
+- `drills` (default is true) - lets you drill through the dashboard
+- `initial-parameters` - default value for dashboard filters, like `{ 'productId': '42' }`.
Make sure to use single quotes if you are surrounding your attribute value with double quotes:
@@ -315,7 +315,7 @@ Renders a dashboard.
></metabase-dashboard>
```
-- `hidden-parameters` - list of filter names to hide from the dashboard, e.g. `['productId;]`
+- `hidden-parameters` - list of filter names to hide from the dashboard, like `['productId']`
Make sure to use single quotes if you are surrounding your attribute value with double quotes:
@@ -328,23 +328,23 @@ Renders a dashboard.
### Question
+To render a question (chart).
+
```html
<metabase-question question-id="1"></metabase-question>
```
-Renders a question (chart).
-
**Required parameters:**
-- `question-id` - This can be a regular ID or an entity ID. [Using Entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) in your embeds will ensure sure that the IDs are stable when exporting from one Metabase and importing to another Metabase.
+- `question-id` - This can be a regular ID or an entity ID. [Using Entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) in your embeds ensures that the IDs stay stable when exporting from one Metabase and importing to another.
Use `question-id="new"` to embed the query builder exploration interface.
**Optional parameters:**
-- `drills` (default is true) - lets you drill-through the question
-- `with-title` (default is true) - render the title or not
-- `with-downloads` (default is false) - render the downloads or not
-- `initial-sql-parameters` - default value for SQL parameters, only applicable to native SQL questions. e.g. `{ "productId": "42" }`
+- `drills` (default is true) - lets you drill through the question
+- `with-title` (default is true) - show the title
+- `with-downloads` (default is false) - show downloads
+- `initial-sql-parameters` - default value for SQL parameters, only applicable to native SQL questions, like `{ "productId": "42" }`
- `is-save-enabled` (default is false)
- `target-collection` - this is to enforce saving into a particular collection. Values: regular ID, entity ID, `"personal”`, `"root”`