API Reference
ReactionSDK client methods and REST entrypoints for overlay interactions on video. For ReactifySDK (recorded reactions, threads, uploads) and /api/reactify/*, see ReactifySDK API reference.
createOverlay()
ReactionSDKCreates and attaches an overlay (tap, poll, rating, slider, or CTA) to a video element. The overlay is rendered in the DOM and starts listening for user interactions. Use this when you need to add overlays programmatically instead of via markup.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| videoElement | HTMLVideoElement | Yes | The video element to attach the overlay to. |
| options | OverlayOptions | Yes | Configuration: type ('tap' | 'rating' | 'poll' | 'slider' | 'cta'), position, pollQuestion, ctaText, etc. |
| campaignId | string | No | Optional campaign ID for analytics attribution. |
Example usage
const video = document.querySelector('#my-video');
ReactionSDK.createOverlay(video, {
type: 'rating',
position: 'bottom-center',
ctaText: 'Submit',
});
// Overlay is now visible and tracking interactions.Response structure
{
"success": true,
"overlayId": "ovl_abc123",
"videoId": "vid_xyz789"
}trackInteraction()
ReactionSDKSends an interaction event to the ReactionSaaS ingest API. Call this when you capture a custom interaction (e.g. from your own UI) or to batch events. For overlay-driven interactions, the SDK calls this automatically.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| payload | InteractionPayload | Yes | Event payload: eventType, interactionType, value, videoId, sessionId, timestampMs, etc. |
| options | { dedupeKey?: string } | No | Optional deduplication key to avoid double-counting. |
Example usage
ReactionSDK.trackInteraction({
eventType: 'interaction',
interactionType: 'rating',
value: 5,
videoId: 'product-demo-1',
sessionId: 'sess_xyz',
timestampMs: Date.now(),
});Response structure
{
"ok": true,
"eventId": "evt_123abc",
"receivedAt": "2024-01-15T14:32:18.500Z"
}getAnalytics()
ReactionSDKReturns analytics for the current account or a given campaign/creative. Use this to fetch impression counts, interaction counts, and engagement metrics client-side (e.g. for in-app dashboards). For full analytics, use the dashboard or REST API.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| params | GetAnalyticsParams | No | Optional: campaignId, creativeId, dateFrom, dateTo. Omit for account-level summary. |
Example usage
const analytics = await ReactionSDK.getAnalytics({
campaignId: 'camp_abc',
dateFrom: '2024-01-01',
dateTo: '2024-01-31',
});
console.log(analytics.impressions, analytics.interactions, analytics.engagementRate);Response structure
{
"impressions": 125000,
"interactions": 48200,
"engagementRate": 0.3856,
"byType": {
"tap": 12000,
"rating": 18000,
"poll": 10000,
"slider": 8200
},
"period": { "from": "2024-01-01", "to": "2024-01-31" }
}REST API
For server-side and high-volume use, see the REST API: event ingestion (POST /api/sdk/event), init (POST /api/sdk/init), conversion (POST /api/sdk/conversion), and dashboard analytics endpoints. Authentication uses a Bearer API key.

