Installation
Install the Inpera embed script to start collecting DOM data and enable annotations on your website.
Embed Snippet
Add this snippet before the closing </body> tag:
<script>
!function(p){var s=document.createElement("script");
s.src="https://cdn.inpera.app/embed.min.js";
s.defer=true;
s.setAttribute("data-project-key", p);
document.head.appendChild(s);
}("YOUR_PROJECT_KEY_HERE");
</script>
Replace YOUR_PROJECT_KEY_HERE with your project key from the Inpera dashboard.
Configuration Options
Customize behavior with data attributes:
<script
src="https://cdn.inpera.app/embed.min.js"
defer
data-project-key="YOUR_PROJECT_KEY_HERE"
data-api-url="https://api.inpera.app"
></script>
| Attribute | Required | Description |
|---|---|---|
data-project-key |
Yes | Your Inpera project key |
data-api-url |
No | Custom API endpoint (defaults to https://api.inpera.app) |
Manual Initialization
For advanced use cases:
const embed = new InperaEmbed({
projectKey: 'YOUR_PROJECT_KEY',
apiUrl: 'https://api.inpera.app',
batchInterval: 2000,
maxRetries: 5,
enabled: true
});
embed.init();
What Gets Collected
DOM Snapshot
- Element structure (tag, id, classes, attributes)
- Text content (trimmed to 100 characters)
- Computed styles for key elements (h1-h6, p, div, button, img, input)
- Element positions and dimensions
- Asset URLs (images, videos, scripts, stylesheets)
- Loaded font families
- Viewport dimensions
Event Tracking
- Clicks: Element metadata, position (x, y), timestamp
- Hovers: Element metadata (throttled to 100ms), position
- Inputs: Element metadata, input type, value length (never actual value)
Performance
- Size: < 35KB gzipped
- CPU Usage: < 2% average
- Memory: Minimal footprint
- Network: Batched requests every 2 seconds
- DOM Operations: Uses
requestIdleCallbackfor heavy scans
Browser Support
| Browser | Minimum Version |
|---|---|
| Chrome/Edge | Latest 2 versions |
| Firefox | Latest 2 versions |
| Safari | Latest 2 versions |
| Mobile | iOS Safari, Chrome Mobile |
Verifying Installation
- Add the script to your site
- Open browser DevTools (Network tab)
- Look for requests to
api.inpera.app/v1/collect - Check the Inpera dashboard for incoming data