Skip to main content
This section documents the Encore Web SDK’s complete public API in a consistent format with clean parameter tables, comprehensive usage examples, and best practices.
Looking for integration guides?
  • New to Encore? Start with the Getting Started Guide for portal-guided setup
  • Step-by-step integration: See the Web Quickstart for detailed installation and configuration instructions
  • Framework patterns: Check the Framework Integration Guide for React, Vue, Angular examples
  • Advanced setups: This reference section is ideal for looking up specific methods, parameters, and advanced usage patterns

Core Methods

configure()

Initialize the SDK with your public API key and optional configuration

presentOffer()

Display targeted offers to users and handle results

placement()

Fluent builder pattern for presenting offers with chained callbacks

isActive()

Check if a specific entitlement type is currently active

User Management

identify()

Associate your user ID with Encore for cross-device tracking

setUserAttributes()

Set user attributes for targeting and personalization

reset()

Clear user identity, attributes, and cached entitlements

Event Handling & Reactive Updates

on()

Subscribe to entitlement change events

observeEntitlement()

Reactively observe specific entitlement states

refreshEntitlements()

Manually refresh entitlements from the server

Grant Signals & Verification

didGrant()

Notify backend when you’ve granted access to a feature

waitForVerification()

Poll for advertiser verification of a conversion

Error Handling

Error Types

Complete error codes, types, and handling strategies

Quick Reference Example

Here’s a complete example showing the most common SDK methods:
import Encore from '@encorekit/web-sdk';

// 1. Configure SDK
Encore.configure({
  apiKey: 'pk_your_api_key_here',
  logLevel: 'debug'
});

// 2. Identify user (optional)
Encore.identify('user-123', {
  email: 'user@example.com',
  subscriptionTier: 'free'
});

// 3. Present offer
const result = await Encore.presentOffer();

if (result.granted) {
  console.log('Entitlement granted:', result.entitlement);
}

// 4. Check entitlements
if (Encore.isActive({ type: 'freeTrial' })) {
  unlockPremiumFeatures();
}

// 5. Subscribe to changes
const unsubscribe = Encore.on('entitlementChanged', (event) => {
  console.log('Entitlement changed:', event);
  updateUI();
});

// 6. Cleanup
unsubscribe();

TypeScript Support

The SDK includes comprehensive TypeScript type definitions:
import Encore, {
  type EntitlementType,
  type EntitlementScope,
  type PresentationResult,
  type UserAttributes,
  type EncoreConfig,
  type EncoreError
} from '@encorekit/web-sdk';

// Types are automatically inferred
const result: PresentationResult = await Encore.presentOffer();
const isActive: boolean = Encore.isActive({ type: 'freeTrial' });

Method Categories

Initialization

  • configure() - Initialize the SDK
  • getVersion() - Get SDK version
  • setLogLevel() - Change log level

User Identity

  • identify() - Identify users
  • getCurrentUserId() - Get current user ID
  • setUserAttributes() - Set user attributes
  • getUserAttributes() - Get user attributes
  • reset() - Reset all user data

Offer Presentation

  • presentOffer() - Show offers with promises/callbacks
  • placement() - Fluent builder for offers

Entitlement Checking

  • isActive() - Check entitlement status
  • refreshEntitlements() - Manually refresh
  • on() - Subscribe to changes
  • observeEntitlement() - Observe specific entitlement

Grant Signals

  • didGrant() - Send grant signals
  • waitForVerification() - Poll for verification

Next Steps

Explore the detailed documentation for each method, or return to the integration guides: