Set up JavaScript for streaming media
The Media SDK for JavaScript (3.x) sends streaming media data directly to Adobe Analytics. This page covers the manual JavaScript installation. To deploy the SDK through Tags instead, see Set up the Media Analytics tag extension. For new implementations, consider using the Web SDK to send data to Adobe Analytics through an Edge Network datastream.
-
Prerequisites:
- Complete the Analytics-only implementation overview.
- Implement AppMeasurement and the Visitor ID Service.
- Download the Media SDK for JavaScript.
Install and configure the SDK
-
Host
MediaSDK.js(from the downloadedlibsdirectory) on a web server accessible to all pages, and reference it on each page:code language-html <script type="text/javascript" src="https://INSERT-DOMAIN-AND-PATH/MediaSDK.js"></script> -
Configure the Media SDK once per page, passing the
appMeasurementinstance that you set up as a prerequisite:code language-js var mediaConfig = new ADB.MediaConfig(); mediaConfig.trackingServer = "<media_collection_server>"; mediaConfig.playerName = "player_name"; mediaConfig.channel = "sample_channel"; mediaConfig.appVersion = "app_version"; mediaConfig.ssl = true; ADB.Media.configure(mediaConfig, appMeasurement);note NOTE The mediaConfig.trackingServervariable is your media collection server (for example,[namespace].hb-api.omtrdc.net). This collection server is distinct from the Analytics tracking server configured within the AppMeasurement instance. -
Create a tracker instance with
getInstance. Keep the instance accessible for the entire media session:code language-js var tracker = ADB.Media.getInstance();
Track media events
With the tracker created, track each media event using its tracker method. See the Media SDK JS 3.x tab on each event and variable page for the exact calls.
Next step
Once your implementation is complete, you can Set up reporting for Analytics-only implementations.