Skip to content

Commit

Permalink
docs: add loom demo code snippet url (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoviana authored Feb 24, 2025
1 parent cec3699 commit 8facd28
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion docs/references/embedding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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:

<div
style={{
position: 'relative',
paddingBottom: '65%',
height: 0,
}}
>
<iframe
src="https://www.loom.com/embed/dd1889b09b364baa8fd606203cddc45d?sid=18b6f137-a175-422c-9f88-d679c99e3018"
frameborder="0"
webkitallowfullscreen
mozallowfullscreen
allowfullscreen
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%',
}}
></iframe>
</div>

<br />

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.
Expand Down

0 comments on commit 8facd28

Please sign in to comment.