Trillboards
Back to Developers
Developer Docs

Trillboards Connect.

Monetize any screen in 3 lines of code

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

Terminal
npm install @trillboards/connect

Initialize and Play

app.js
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.

index.html
<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.

OptionTypeDefaultDescription
apiKeystringrequiredPartner API key (trb_partner_xxx)
deviceIdstringrequiredUnique device identifier
containerIdstring | HTMLElementnullDOM container for ad rendering
options.heartbeatIntervalnumber60000Heartbeat interval in ms
options.adIntervalnumber60Ad rotation interval in seconds
options.mutedbooleantrueStart video ads muted
options.offlineCachebooleantrueEnable IndexedDB offline caching
options.analyticsbooleantrueEnable analytics event buffering
options.deviceTypestringdigital_signageDevice type for registration
options.objectFitstringcoverCSS object-fit for ad rendering

Events

Listen for SDK lifecycle events using the on() method.

EventDataDescription
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

MethodDescription
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, heartbeat
  • auctionβ€” Ad fetching, rendering, VAST parsing
  • offlineβ€” IndexedDB caching and impression queue
  • brandingβ€” CSS injection and white-labeling
  • analyticsβ€” 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.

FeatureConnectAds SDK
Setup complexity3 linesFull SDK integration
Framework requiredNoneReact / Node.js
Server SDKNoYes β€” PartnerClient
React hooksNoYes β€” useTrillboardsAds()
Offline cachingBuilt-inBuilt-in
Auto device registrationYesManual via API
VAST tag builderNoYes
AnalyticsAuto-bufferedFull control
Best forQuick embed, kiosksCustom 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.