Embedded Analytics is available on the Enterprise Plan. Contact us to upgrade
- Match your brand with custom themes
- Show different data to each user based on their permissions
- Embed specific pages from your Evidence project
- Support multiple languages
- Your development team will need to add a backend endpoint to request embed URLs from the Evidence Embed API
- Each embedded report loads in an iframe on your page
How It Works
The Evidence Embed API allows you to embed Evidence reports directly inside your own application using iframe embedding with secure authentication. The embed process uses a two-step authentication flow:- Server-side: Your backend requests an embed URL from the Evidence Embed API for a specific user
- Client-side: The embed URL is loaded in an iframe, establishing an encrypted session in the user’s browser
Authentication
- Single-use URLs: Each embed URL contains a nonce that expires in 2 minutes and can only be used once
- JWE Encryption: User attributes and metadata are encrypted using JSON Web Encryption
- Row Level Security: Integrates with access control rules to filter data by user
Getting Started
1
Set Up and Publish a Page
Create the Evidence page you want to embed and publish your project. The page must be published before it can be embedded.Make note of the page’s:
- Page ID: Found in page settings
- Path: The full path to the page (e.g.,
org_id/project_name/page_name)
2
Create RLS Rules (Optional)
If you need to filter data based on user attributes, set up row-level security rules in your Access Settings.Define which user attributes will be used to filter data (e.g.,
employee_id, region, department).3
Create an API Key
Navigate to your Organization Settings and create a new API key for the Evidence Embed API. Store this key securely - you’ll need it to authenticate API requests.
4
Test the API
Test the Evidence Embed API using The API will return a response with a
curl to verify your setup. Replace YOUR_API_KEY, YOUR_PAGE_ID, and YOUR_PAGE_PATH with your values:url field. Copy this URL and open it in an incognito/private browser window to verify the page loads correctly.Use
cookieless: true when testing to avoid cookie-related issues in development.5
Backend Integration
Add an endpoint to your backend server that requests embed URLs for authenticated users.Example:Store your API key securely on the server and never expose it to the client.
6
Frontend Integration
Request an embed URL from your backend endpoint and use it to load the report in an iframe:Use the full URL returned from your backend in the iframe’s
src attribute.API Reference
POST /v1/embedded
Creates a secure embed session and returns a single-use embed URL.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | Unique identifier for the user viewing the report |
pageId | string | Yes | UUID of the specific page to embed |
path | string | Yes | Path to the page (e.g., “org_id/project/page-name”) |
ttl | number | No | Time-to-live in seconds (default: 3600, max: 604800) |
attributes | array | No | User attributes for row-level security |
cookieless | boolean | No | Enable cookieless mode (default: false) |
testMode | boolean | No | Enable test mode (default: false) |
language | string | No | Display language code (e.g., “en”, “fr”) |
User Attributes
User attributes are used with row-level security rules to filter data. Evidence supports rich attribute types:- Strings:
"Canada","Sales" - Numbers:
1102,42.5 - Booleans:
true,false - String Arrays:
["Sales", "Marketing"] - Number Arrays:
[193, 992, 19183]
Attributes can be included in embed requests even if they’re not currently mapped to an RLS rule.
Response
url field contains a single-use embed URL with an embedded nonce. Use this full URL in your iframe’s src attribute.
GET /v1/embedded/
Loads the embedded report when accessed via iframe. The nonce in the URL path is validated and can only be used once.Configuration Options
Time-to-Live (TTL)
Control how long an embed session remains valid:- Minimum: 60 seconds (1 minute)
- Maximum: 604800 seconds (7 days)
- Default: 3600 seconds (1 hour)
Embed URLs are valid for 2 minutes and can only be used once. The TTL parameter controls the session duration after the URL is accessed.
Cookieless Mode
Enable cookieless mode for privacy compliance:- GDPR and privacy compliance requirements
- Third-party cookie restrictions
- Environments where cookies are blocked
Language Support
Embed reports in different languages if your Evidence project supports translations:Test Mode
Use test mode for development and debugging onlocalhost
Implementation Guidelines
Security
- Protect your API key: Make Evidence Embed API requests from your backend server only, never from client-side code
- Set appropriate TTLs: Use the shortest TTL that meets your requirements
- Validate users: Verify user authentication before requesting embed URLs
- Apply RLS rules: Use row-level security to filter data appropriately
Performance
- Pre-generate URLs: Request embed URLs before the user navigates to the page to reduce perceived loading time
- Session refresh: Implement logic to refresh sessions before they expire for long-running user sessions
Error Handling
- Handle expired sessions: Implement logic to request new embed URLs when sessions expire
- Provide feedback: Show loading states and clear error messages
- Handle edge cases: Test behavior with expired URLs, network failures, and long-running sessions
Frequently Asked Questions
Can I embed multiple pages for the same user?
Can I embed multiple pages for the same user?
Yes, request a separate embed URL for each page you want to embed.
What happens when a session expires?
What happens when a session expires?
The iframe will show an error. Request a new embed URL from your backend and update the iframe’s
src attribute. Consider implementing automatic session refresh before the TTL expires for long-running sessions.Can I style the embedded report?
Can I style the embedded report?
Yes, use themes to customize the appearance of embedded reports.
Do embedded reports support interactivity?
Do embedded reports support interactivity?
Yes, inputs, filters, and other interactive features work in embedded reports.
How do I debug embed issues?
How do I debug embed issues?
Enable
testMode: true during development to see detailed error messages. Check the browser console and network tab for additional debugging information.
