Back to Documentation
Getting Started
Installation Guide
Get up and running with Rewatched in under 5 minutes
1. Create an Account
First, sign up for a Rewatched account. You'll get immediate access to the dashboard and can start tracking your application right away.
Sign up for free2. Create Your First Application
After signing up, navigate to the Domains page and create your first application:
- Go to Domains & Apps in the sidebar
- Click Add Application
- Enter your application name and URL
- Click Create
You'll receive a unique SDK key for your application.
3. Install the SDK
Add the Rewatched snippet to your application. You can install via npm or use our CDN.
Option A: NPM Installation
bash
npm install @rewatched/analytics
# or
yarn add @rewatched/analyticsOption B: CDN Script Tag
html
<script>
!function(w,d,s){
var r=w.rewatched=w.rewatched||[];
if(!r.init){
r.init=function(){r.push(arguments)};
var script=d.createElement(s);
script.async=1;
script.src='https://cdn.rewatched.io/sdk/v1/analytics.js';
d.head.appendChild(script);
}
}(window,document,'script');
rewatched.init('YOUR_SDK_KEY', {
apiHost: 'https://api.rewatched.io',
autocapture: true
});
</script>4. Initialize the SDK
Configure the SDK with your API key and options:
import rewatched from '@rewatched/analytics';
rewatched.init('YOUR_SDK_KEY', {
apiHost: 'https://api.rewatched.io',
autocapture: true, // Automatic event tracking
persistence: 'localStorage', // Cookie or localStorage
sessionRecording: true, // Enable session replay
capturePageviews: true // Track page views
});Important: Replace YOUR_SDK_KEY with the actual SDK key from your application settings.
5. Verify Installation
After installing the SDK, verify that events are being tracked:
- Visit your application in a browser
- Perform some actions (clicks, page views)
- Go to your Rewatched dashboard
- Navigate to Analytics
- You should see events appearing within a few seconds
Success! If you see events in your dashboard, you're all set. If not, check the browser console for errors.
Next Steps
Troubleshooting
Events not appearing in dashboard
- Check that you're using the correct SDK key
- Verify the application URL is whitelisted in your app settings
- Look for errors in the browser console
- Ensure the SDK script is loading (check Network tab)
CORS errors
- Add your domain to the whitelist in application settings
- For localhost development, ensure "Allow localhost" is enabled