Overview
Trillboards Connect is a zero-friction onboarding SDK for digital signage ad monetization. One init() call handles device registration, ad fetching, rendering, offline caching, and analytics β no framework required.
When to Use Connect
- You want ads running with minimal code β no build system required
- You need offline caching and auto-heartbeat out of the box
- You want a drop-in solution for any web page or WebView
- You don't need React hooks or server-side SDK features
Quick Start
NPM Installation
npm install @trillboards/connectInitialize and Play
const TrillboardsConnect = require('@trillboards/connect');
// or: import TrillboardsConnect from '@trillboards/connect';
const trillboards = TrillboardsConnect.init({
apiKey: 'YOUR_API_KEY',
deviceId: 'my-screen-001',
containerId: 'ad-container',
options: {
heartbeatInterval: 60000,
adInterval: 60,
muted: true,
offlineCache: true,
analytics: true,
},
});
trillboards.on('ready', (data) => {
console.log('SDK ready:', data.fingerprint);
});
trillboards.on('ad_start', (data) => {
console.log('Ad started:', data.ad.id);
});Script Tag
For non-NPM users, load Connect via CDN. The global TrillboardsConnect object is available immediately.
<div id="ad-container" style="width:100%;height:100vh;"></div>
<script src="https://unpkg.com/@trillboards/connect/dist/trillboards-connect.global.js"></script>
<script>
const trillboards = TrillboardsConnect.init({
apiKey: 'YOUR_API_KEY',
deviceId: 'my-screen-001',
containerId: 'ad-container',
});
trillboards.on('ready', function(data) {
console.log('Ads ready:', data.fingerprint);
});
</script>Configuration
Pass configuration options to init() to customize behavior. Only apiKey and deviceId are required.
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Partner API key (trb_partner_xxx) |
deviceId | string | required | Unique device identifier |
containerId | string | HTMLElement | null | DOM container for ad rendering |
options.heartbeatInterval | number | 60000 | Heartbeat interval in ms |
options.adInterval | number | 60 | Ad rotation interval in seconds |
options.muted | boolean | true | Start video ads muted |
options.offlineCache | boolean | true | Enable IndexedDB offline caching |
options.analytics | boolean | true | Enable analytics event buffering |
options.deviceType | string | digital_signage | Device type for registration |
options.objectFit | string | cover | CSS object-fit for ad rendering |
Events
Listen for SDK lifecycle events using the on() method.
| Event | Data | Description |
|---|---|---|
ready | { deviceId, fingerprint, screenId } | SDK fully initialized |
device_registered | { fingerprint, screen_id, embed_url } | Device registered with API |
ad_start | { ad, type, timestamp } | Ad started rendering |
ad_complete | { ad, type, duration, completed } | Ad finished rendering |
ad_error | { ad, type, error } | Ad rendering error |
impression | { ad, result, totalImpressions } | Impression tracked |
heartbeat | { beat, status, timestamp } | Heartbeat sent |
sync_complete | { total, synced, failed } | Offline impressions synced |
connectivity_change | { online } | Online/offline status changed |
error | { phase, error } | General error |
Instance Methods
| Method | Description |
|---|---|
on(event, cb) | Register an event listener |
off(event, cb) | Remove an event listener |
nextAd() | Skip to the next ad |
pause() | Pause ad rotation |
resume() | Resume ad rotation |
getState() | Get complete SDK state |
syncOffline() | Force sync offline impressions |
destroy() | Clean up all resources |
Sub-Modules
For advanced usage, sub-modules are exposed directly on the instance:
deviceβ Registration, fingerprinting, heartbeatauctionβ Ad fetching, rendering, VAST parsingofflineβ IndexedDB caching and impression queuebrandingβ CSS injection and white-labelinganalyticsβ Event buffering and batch sending
Connect vs Ads SDK
Both products use the same API key and Trillboards infrastructure. Here's when to use each.
| Feature | Connect | Ads SDK |
|---|---|---|
Setup complexity | 3 lines | Full SDK integration |
Framework required | None | React / Node.js |
Server SDK | No | Yes β PartnerClient |
React hooks | No | Yes β useTrillboardsAds() |
Offline caching | Built-in | Built-in |
Auto device registration | Yes | Manual via API |
VAST tag builder | No | Yes |
Analytics | Auto-buffered | Full control |
Best for | Quick embed, kiosks | Custom apps, dashboards |
Need Help?
Contact our developer support at developers@trillboards.com or visit the Support page.
Ready to start?
One init() call to start showing ads. Zero friction.