Setup & Installation
Get the Insights SDK running in under 2 minutes
Last updated:
Installation
npm / ES Module
npm install @sessionsight/insightsThen initialize in your app:
Initialize
import SessionSight from '@sessionsight/insights';
SessionSight.init({
publicApiKey: 'YOUR_PUBLIC_API_KEY',
propertyId: 'YOUR_PROPERTY_ID',
});Script Tag
If you’re not using a bundler, add the script tag directly:
Script tag
<!-- SessionSight · sessionsight.com -->
<!-- Paste this just before </head> on every page you want to track. -->
<script>
(function sessionsight(w,i,n,s){
var q=w._ssq=[],p=P=>new Proxy(function(){},{
get:(_,k)=>k=='then'||typeof k=='symbol'?void 0:p(P.concat(k)),
apply:(_,__,a)=>new Promise((rs,rj)=>q.push({p:P,a,rs,rj}))
});
w.SessionSight=p([]);
var e=i.createElement('script');e.async=1;e.src=n;i.head.appendChild(e);
w.SessionSight.init(s);
})(window,document,'https://cdn.sessionsight.com/sessionsight.js',{
publicApiKey:'YOUR_PUBLIC_API_KEY',
propertyId:'YOUR_PROPERTY_ID'
});
</script>Configuration
| Option | Type | Default | Description |
|---|---|---|---|
publicApiKey | string | required | Your public API key from the API Keys page |
propertyId | string | 'dev' | Your property ID from the Properties page. Defaults to 'dev' for localhost development |
apiUrl | string | https://api.sessionsight.com | Override for self-hosted or local dev |
autoRecord | boolean | true | Start recording immediately on init |
consent | 'anonymous' \| 'full' \| boolean \| (() => 'anonymous' \| 'full' \| boolean) | 'full' | Which tier the SDK runs in. 'anonymous' (or legacy false) captures aggregate counters with no cookies or replay; 'full' (or legacy true) captures identified sessions with replay. Pass a function for reactive consent (polled every second). See Consent |
honorConsentMode | boolean | false | Opt into Google Consent Mode v2 auto-wiring. When true, the SDK reads analytics_storage at init and observes gtag('consent', 'update', ...) calls. See Consent |
For framework-specific examples (React, SvelteKit, Vue, Angular), see the Framework Guides.
Verify It’s Working
After adding the SDK:
- Open your site in a browser
- Navigate around for a few seconds
- Go to your SessionSight dashboard and open Live View
- You should see your session appear in real-time
If you don’t see it, check the browser console for errors. The most common issues are an incorrect API key or property ID.