diff --git a/docs/references/embedding.mdx b/docs/references/embedding.mdx index e387998..5016c8d 100644 --- a/docs/references/embedding.mdx +++ b/docs/references/embedding.mdx @@ -200,7 +200,7 @@ Clicking `generate & copy url` will generate an embed URL based on the configura You can embed this one-off URL directly into your application, but you will manually need to update the URL each time the embed URL expires. Alternatively, you can add the [`code snippet`](#code-snippet) to your app to automatically generate embed URLs in your application. -## Code snippet +## Code snippet & demo Although you can generate URLs directly from Lightdash with a long expiration, it is recommended to generate your own JWT embed tokens in your backend with a short expiration using your `secret` to make sure people can't be using embed URLs outside your app. @@ -213,6 +213,35 @@ To make this easier to integrate, we included some code snippets you can copy an style={{ display: 'block', margin: '0 auto 20px auto' }} /> +Here is a demo of how to add the code snippet to your app: + +
+ +
+ +
+ +You can find the source code [here](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app). + ### User metadata You can pass user metadata (specifically, an external user ID) from your application so that anytime someone views your embedded dashboard and runs queries in Lightdash, these query logs are enriched with this user metadata. Specifcally, this user metadata gets added to the [query tags](/references/usage-analytics.mdx#query-tags) for queries run in Lightdash.