@theoplayer/react-native-analytics-nielsen
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

THEOplayer React-Native Nielsen Connector

A Nielsen analytics connector for @theoplayer/react-native.

Installation

npm install @theoplayer/react-native-analytics-nielsen

Usage

Configuring the connector

Create the connector by providing the THEOplayer instance, the appId provided by Nielsen, and instanceName that describes the player or site, and an optional set of NielsenOptions:

import { useNielsen } from '@theoplayer/react-native-analytics-nielsen';

const appId = 'PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';

const instanceName = 'THEOplayer demo';

const nielsenOptions: NielsenOptions = {
  // Enables Debug Mode which allows output to be viewed in console
  nol_sdkDebug: 'debug'

  // HTML DOM element id of the player container (if implementing Viewability/Audibility)
  // containerId: 'player1',

  // Optout on initialization of the SDK
  // optout: false,
};

const App = () => {
  const [nielsen, initNielsen] = useNielsen(appId, instanceName, nielsenOptions);

  const onPlayerReady = (player: THEOplayer) => {
    // Initialize Nielsen connector
    initNielsen(player);
  }

  return (<THEOplayerView config={playerConfig} onPlayerReady={onPlayerReady}/>);
}

Passing metadata dynamically

The connector allows passing or updating the current asset's metadata at any time:

const onUpdateMetadata = () => {
  nielsen.current?.updateMetadata({
    'title': 'Episode Title',
    'assetid': 'unique_id_500291'
  });
};

Package Sidebar

Install

npm i @theoplayer/react-native-analytics-nielsen

Weekly Downloads

3

Version

1.4.0

License

SEE LICENSE AT https://www.theoplayer.com/terms

Unpacked Size

54.9 kB

Total Files

71

Last publish

Collaborators

  • theotechnologies-admin