Tapemetric

SDKs

Smart TV SDK

One SDK for Tizen (Samsung), WebOS (LG), Fire TV, Android TV, and tvOS.

Which SDK for which TV platform?

PlatformInstall
Samsung TizenWeb SDK (CDN)
LG WebOSWeb SDK (CDN)
HbbTV / VestelWeb SDK (CDN)
Android TV / Fire TVAndroid SDK
Apple tvOSiOS SDK

Tizen & WebOS (web-based)

Tizen and WebOS run Chromium under the hood. Drop the Web SDK into yourindex.html:

html
<style="color:#f472b6">script src="https://cdn.tapemetric.com/v1/tapemetric.min.js"></style="color:#f472b6">script>
<style="color:#f472b6">script>
  var rd = Tapemetric.init({ apiKey: 'tm_live_...' });
  rd.trackPageView();
</style="color:#f472b6">script>

The SDK auto-detects the device as tv from UA strings matching:

text
/smart-tv|smarttv|tizen|webos|bravia|hbbtv/i

Tizen-specific: handle sleep

Tizen fires visibilitychange on screen-off. The SDK flushes queued events via sendBeacon automatically.

WebOS-specific: remote keys

Wire D-pad events to engagement tracking so you know how users navigate your home screen:

javascript
document.addEventListener('keydown', (e) => {
  if (e.key === 'ArrowRight') {
    rd.track({ eventType: 'browse_tile_focus', properties: { direction: 'right' } });
  }
});

Android TV / Fire TV

Use the Android SDK. The SDK auto-detectsUI_MODE_TYPE_TELEVISION and sets device_type to tv.

Apple tvOS

Use the iOS SDK — the same package works on tvOS with AVPlayer integration.

Roku (HTTP API)

Roku’s BrightScript runtime has no official Tapemetric SDK. Use the HTTP ingest API directly:

brightscript
sub trackPlayStart(contentId as String)
    req = CreateObject("roUrlTransfer")
    req.SetUrl("https://ingest.tapemetric.com/v1/ingest/events")
    req.AddHeader("X-API-Key", "tm_live_...")
    req.AddHeader("Content-Type", "application/json")
    body = "{""events"":[{""event_type"":""play_start"",""ts"":""" + FormatJson(CreateObject("roDateTime").AsSeconds()) + """,""anonymous_id"":""" + getAnonId() + """,""session_id"":""" + getSessionId() + """,""content_id"":""" + contentId + """,""content_type"":""film""}]}"
    req.AsyncPostFromString(body)
end sub
For Roku, always batch events and post every 10 seconds. BrightScript network calls are slow; one-event-per-post will kill your app’s smoothness.

Smart-TV QoS notes

  • Bitrate detection on Tizen requires webapis.avplay.getCurrentStreamInfo().
  • WebOS exposes bitrate via the MediaOption API.
  • Android TV works the same as Android phones — use ExoPlayer’s AnalyticsListener.