New to Encore? We recommend starting with our Getting Started Guide which walks you through account creation and guided setup via the Dashboard. This page is for developers who need detailed installation instructions or advanced configuration.
Overview
The Encore Web SDK is a lightweight JavaScript/TypeScript library that enables web applications to display targeted offers and track entitlements. It’s framework-agnostic and works with React, Vue, Angular, Svelte, vanilla JavaScript, or any web framework.Prerequisites: Obtain Access Credentials
Before installing the SDK, you need to obtain your API key from the Encore Dashboard.Don’t have credentials? Visit dashboard.encorekit.com to create an account, add your app, and receive your API key automatically.
- API Key: Your public API key (starts with
pk_...) provided through the Dashboard
Installation Options
Choose your preferred installation method:- npm
- yarn
- pnpm
- CDN (Vanilla JS)
Verify Installation
After installation, verify the SDK is accessible:- ES Modules
- CommonJS
- CDN
Browser Compatibility
The Encore Web SDK supports modern browsers:- Chrome/Edge: Last 2 versions
- Firefox: Last 2 versions
- Safari: Last 2 versions
- iOS Safari: 15+
- Android Chrome: Last 2 versions
- ES2022 support (native, no polyfills needed)
- localStorage support (with fallback to sessionStorage)
- fetch API support
- Modern JavaScript features (async/await, Promises)
Next Steps
Now that the SDK is installed, continue with the integration:- Configure the SDK - Set up your API key and initialize Encore
- Identify Users - Learn how to identify users for offer tracking
- Present Offers - Start showing offers in your app
- Track Entitlements - Check subscription status in real-time
Advanced Topics
TypeScript Configuration
TypeScript Configuration
The SDK includes TypeScript type definitions out of the box. No additional configuration is needed.Import types explicitly:
Webpack Configuration
Webpack Configuration
The SDK works out of the box with Webpack. For optimal bundle sizes, ensure tree-shaking is enabled:
webpack.config.js
Vite Configuration
Vite Configuration
The SDK works seamlessly with Vite. No additional configuration needed:
vite.config.ts
Content Security Policy (CSP)
Content Security Policy (CSP)
If you use Content Security Policy, add these directives:For CDN installations, allow the encorekit.com domain. For API calls, allow the Encore API domain.
Bundle Size
Bundle Size
The Encore Web SDK is optimized for performance:
- Total size: Less than 50KB gzipped
- Tree-shakeable: Only import what you use
- No dependencies: Zero external dependencies
- Lazy-loadable: Can be loaded dynamically
Offline Support
Offline Support
The SDK automatically handles offline scenarios:
- Grant signals are queued in localStorage when offline
- Signals are sent automatically when connectivity is restored
- Exponential backoff for retries (maximum 3 attempts)
- No configuration needed - works automatically