This guide is for developers. If you just want to share a dashboard link, see Embedding a shared dashboard; you don’t need any of this.
When you copy a shareable link from a shared dashboard, the link contains a web token (a JWT). That standard token gives access to the whole dashboard and never expires.
If you’re putting a dashboard inside your own application or website, you can create your own token instead. Your token can:
- Expire after a date and time you choose.
- Set a starting filter on the dashboard, which viewers can still change.
- Restrict the data a viewer can see, so they only see their own part of it.
How it works
An embedded dashboard link looks like this:
https://insights.learningpool.com/contexts/<context id>/shared/<JWT>
| Part | What it is |
| <context id> | Identifies your organisation’s Analytics account. |
| <JWT> | A signed web token that says which dashboard to open, and optionally when access expires and what data to show. |
You can open the link directly, or put it in an iframe to show the dashboard inside your own page.
What you can put in the token
| Claim | What it does | Can the viewer change it? |
| exp | A Unix timestamp. After this time the link stops working. | No |
| dashboardFilter | Sets a starting filter on a dashboard field, for example one course. | Yes. Viewers can clear it and see all the data. |
| dataModelFilter | Limits the data the viewer can see at all, for example only their own department. | No. Viewers only ever see the permitted data. |
You can use dashboardFilter and dataModelFilter together, for example to limit a viewer to their department’s data and open the dashboard on one course within it.
Use dataModelFilter, not dashboardFilter, to keep data private. A dashboard filter is only a starting point and can be removed.
Setting it up
- Get the shareable link. Open the shared dashboard and select Copy Shareable Link. Note the context ID from the link.
- Get your signing secret from Learning Pool support. Keep it on your server only.
- Build the token payload with the claims you need (see the example below).
- Sign the token with HS256 and your signing secret, on your server.
- Build the link: https://insights.learningpool.com/contexts/<context id>/shared/<JWT>.
- Open the link or embed it in an iframe in your application.
Example payload
This token expires at the end of 2023, opens the dashboard filtered to the verb “completed”, and only lets the viewer see data for “completed” and “attempted”.
{
"exp": 1704067200,
"dashboardFilter": [
{
"jaql": {
"table": "xapi_verbs",
"column": "verb_name",
"dim": "[xapi_verbs.verb_name]",
"datatype": "text",
"merged": true,
"collapsed": false,
"title": "verb_name",
"filter": { "members": ["completed"] }
}
}
],
"dataModelFilter": [
{
"datasourceTitle": "<your data model>",
"table": "xapi_verbs",
"column": "verb_name",
"datatype": "text",
"allMembers": null,
"members": ["completed", "attempted"],
"exclusionary": false
}
]
}
Libraries for creating tokens
| Language | Library |
| Python | Authlib |
| .NET | jose-jwt |
| Java | Nimbus JOSE + JWT |
| Node.js | node-jose |
For testing, you can create a token by hand at jwt.io. Never paste a production signing secret into a website.
Security
- Create tokens on your server, never in the browser. Anyone who sees the signing secret can create a token for any data.
- Always set exp for embedded links, so a leaked link stops working.
- Use dataModelFilter to restrict data. dashboardFilter only sets a starting view.
- The default shareable link has no expiry and no restrictions. Treat it like the dashboard itself.
Troubleshooting
| Problem | Check |
| The link doesn’t open | The token has expired (exp is in the past), or it wasn’t signed with the right secret. |
| The viewer sees too much data | You used dashboardFilter instead of dataModelFilter. |
| The filter has no effect | The table and column names must match the data model exactly, including case. |
Next steps
- Embedding a shared dashboard
- Creating, updating, and managing shared dashboards