@newrelic/video-videojs 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +187 -23
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.LICENSE.txt +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.LICENSE.txt +1 -1
- package/dist/umd/newrelic-video-videojs.min.js +1 -1
- package/dist/umd/newrelic-video-videojs.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [4.1.1](https://github.com/newrelic/video-videojs-js/compare/v4.1.0...v4.1.1) (2026-04-17)
|
|
2
|
+
|
|
3
|
+
### Documentation
|
|
4
|
+
|
|
5
|
+
- **README.md:** Added Best Practices section (contentTitle, userId, custom attributes, gradual rollout with feature flags)
|
|
6
|
+
- **README.md:** Promoted Bitrate Metrics to top-level section with detailed table format and NRQL query examples
|
|
7
|
+
- **README.md:** Updated Data Model event descriptions to include heartbeats and media errors
|
|
8
|
+
- **README.md:** Fixed DATAMODEL.md link casing
|
|
9
|
+
- **README.md:** Updated Table of Contents with new sections (Prerequisites, Best Practices, Bitrate Metrics)
|
|
10
|
+
- **README.md:** Renamed Contributing to Contribute for consistency across trackers
|
|
11
|
+
|
|
1
12
|
## [4.1.0](https://github.com/newrelic/video-videojs-js/compare/v4.0.3...v4.1.0) (2026-04-08)
|
|
2
13
|
|
|
3
14
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -22,13 +22,16 @@ The New Relic Video.js Tracker provides comprehensive video analytics for applic
|
|
|
22
22
|
- [Installation](#installation)
|
|
23
23
|
- [Option 1: NPM/Yarn](#option-1-install-via-npmyarn)
|
|
24
24
|
- [Option 2: Direct Script Include](#option-2-direct-script-include-without-npm)
|
|
25
|
+
- [Prerequisites](#prerequisites)
|
|
25
26
|
- [Usage](#usage)
|
|
27
|
+
- [Best Practices](#best-practices)
|
|
26
28
|
- [Configuration Options](#configuration-options)
|
|
27
29
|
- [API Reference](#api-reference)
|
|
30
|
+
- [Bitrate Metrics](#bitrate-metrics)
|
|
28
31
|
- [Ad Tracking Support](#ad-tracking-support)
|
|
29
32
|
- [Data Model](#data-model)
|
|
30
33
|
- [Support](#support)
|
|
31
|
-
- [
|
|
34
|
+
- [Contribute](#contribute)
|
|
32
35
|
- [License](#license)
|
|
33
36
|
|
|
34
37
|
## Installation
|
|
@@ -91,11 +94,15 @@ For quick integration without a build system, include the tracker directly in yo
|
|
|
91
94
|
|
|
92
95
|
**Setup Steps:**
|
|
93
96
|
|
|
94
|
-
1. **Get Configuration** - Visit [one.newrelic.com](https://one.newrelic.com) and
|
|
95
|
-
2. **
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
1. **Get Configuration** - Visit [one.newrelic.com](https://one.newrelic.com) and follow the Streaming Video & Ads onboarding flow to get your `licenseKey`, `beacon`, `applicationID`, and integration code snippet.
|
|
98
|
+
2. **Integrate** - Include the script in your HTML and initialize with your configuration
|
|
99
|
+
|
|
100
|
+
## Prerequisites
|
|
101
|
+
|
|
102
|
+
Before using the tracker, ensure you have:
|
|
103
|
+
|
|
104
|
+
- **New Relic Account** - Active New Relic account with valid application credentials (`beacon`, `applicationId`, `licenseKey`)
|
|
105
|
+
- **Video.js Player** - Video.js player integrated in your application
|
|
99
106
|
|
|
100
107
|
## Usage
|
|
101
108
|
|
|
@@ -154,6 +161,148 @@ const options = {
|
|
|
154
161
|
const tracker = new VideojsTracker(player, options);
|
|
155
162
|
```
|
|
156
163
|
|
|
164
|
+
## Best Practices
|
|
165
|
+
|
|
166
|
+
### 1. Setting `contentTitle`
|
|
167
|
+
|
|
168
|
+
The `contentTitle` attribute will display a value if your video metadata contains title information. If the metadata does not include a title, `contentTitle` will not be populated. For best results, ensure you explicitly set this attribute during initialization:
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
const tracker = new VideojsTracker(player, {
|
|
172
|
+
info: {
|
|
173
|
+
licenseKey: 'YOUR_LICENSE_KEY',
|
|
174
|
+
beacon: 'YOUR_BEACON_URL',
|
|
175
|
+
applicationId: 'YOUR_APP_ID',
|
|
176
|
+
},
|
|
177
|
+
customData: {
|
|
178
|
+
contentTitle: 'My Video Title', // Explicitly set from your metadata
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
If your title changes dynamically (e.g., playlist or queue):
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
tracker.setOptions({
|
|
187
|
+
customData: {
|
|
188
|
+
contentTitle: 'New Video Title',
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 2. Setting `userId`
|
|
194
|
+
|
|
195
|
+
Set a user identifier to track video analytics per user:
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
// Set userId during initialization
|
|
199
|
+
const tracker = new VideojsTracker(player, {
|
|
200
|
+
info: {
|
|
201
|
+
licenseKey: 'YOUR_LICENSE_KEY',
|
|
202
|
+
beacon: 'YOUR_BEACON_URL',
|
|
203
|
+
applicationId: 'YOUR_APP_ID',
|
|
204
|
+
},
|
|
205
|
+
customData: {
|
|
206
|
+
contentTitle: 'Video Title',
|
|
207
|
+
userId: 'user-12345',
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// Or set userId separately using the API method
|
|
212
|
+
tracker.setUserId('user-12345');
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 3. Adding Custom Attributes for Your Deployment
|
|
216
|
+
|
|
217
|
+
Add custom attributes unique to your deployment to improve data aggregation and analysis:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
const tracker = new VideojsTracker(player, {
|
|
221
|
+
info: {
|
|
222
|
+
licenseKey: 'YOUR_LICENSE_KEY',
|
|
223
|
+
beacon: 'YOUR_BEACON_URL',
|
|
224
|
+
applicationId: 'YOUR_APP_ID',
|
|
225
|
+
},
|
|
226
|
+
customData: {
|
|
227
|
+
// Required for identification
|
|
228
|
+
contentTitle: videoMetadata.title,
|
|
229
|
+
userId: currentUser.id,
|
|
230
|
+
|
|
231
|
+
// Custom attributes for your deployment
|
|
232
|
+
subscriptionTier: 'premium', // User subscription level
|
|
233
|
+
contentProvider: 'studio-abc', // Content source
|
|
234
|
+
region: 'us-west-2', // Geographic region
|
|
235
|
+
cdnProvider: 'cloudflare', // CDN being used
|
|
236
|
+
deviceType: 'desktop', // Device category
|
|
237
|
+
appVersion: '2.1.0', // Your app version
|
|
238
|
+
campaign: 'spring-promo', // Marketing campaign
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Use these attributes in New Relic queries:**
|
|
244
|
+
|
|
245
|
+
```sql
|
|
246
|
+
-- Analyze by subscription tier
|
|
247
|
+
SELECT count(*) FROM VideoAction WHERE actionName = 'CONTENT_START'
|
|
248
|
+
FACET subscriptionTier SINCE 1 day ago
|
|
249
|
+
|
|
250
|
+
-- Monitor by region
|
|
251
|
+
SELECT average(contentNetworkDownloadBitrate) FROM VideoAction
|
|
252
|
+
FACET region SINCE 1 hour ago
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 4. Gradual Rollout with Feature Flags
|
|
256
|
+
|
|
257
|
+
When deploying to production, use feature flags to enable the tracker gradually. This helps you:
|
|
258
|
+
|
|
259
|
+
- Validate data collection without impacting all users
|
|
260
|
+
- Monitor performance impact at scale
|
|
261
|
+
- Catch issues before full deployment
|
|
262
|
+
- Control monitoring costs
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
// Example using a feature flag
|
|
266
|
+
const rolloutPercentage = 5; // Start with 5% of users
|
|
267
|
+
|
|
268
|
+
function shouldEnableTracking(userId) {
|
|
269
|
+
// Simple percentage-based rollout
|
|
270
|
+
const hash = userId
|
|
271
|
+
.split('')
|
|
272
|
+
.reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
273
|
+
return hash % 100 < rolloutPercentage;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const player = videojs('myVideo');
|
|
277
|
+
player.version = videojs.VERSION;
|
|
278
|
+
|
|
279
|
+
// Only initialize tracker if user is in rollout
|
|
280
|
+
if (shouldEnableTracking(currentUser.id)) {
|
|
281
|
+
const tracker = new VideojsTracker(player, {
|
|
282
|
+
info: {
|
|
283
|
+
licenseKey: 'YOUR_LICENSE_KEY',
|
|
284
|
+
beacon: 'YOUR_BEACON_URL',
|
|
285
|
+
applicationId: 'YOUR_APP_ID',
|
|
286
|
+
},
|
|
287
|
+
customData: {
|
|
288
|
+
contentTitle: videoMetadata.title,
|
|
289
|
+
userId: currentUser.id,
|
|
290
|
+
rolloutGroup: `${rolloutPercentage}%`, // Track which rollout group
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Recommended Rollout Schedule:**
|
|
297
|
+
|
|
298
|
+
| Phase | Percentage | Duration | Validation |
|
|
299
|
+
| --------- | ---------- | --------- | ---------------------------------- |
|
|
300
|
+
| Initial | 5% | 2-3 days | Verify data flowing to New Relic |
|
|
301
|
+
| Early | 15% | 3-5 days | Check data quality and performance |
|
|
302
|
+
| Expansion | 25% | 5-7 days | Validate across device types |
|
|
303
|
+
| Majority | 50% | 1-2 weeks | Monitor at scale |
|
|
304
|
+
| Full | 100% | Ongoing | Complete deployment |
|
|
305
|
+
|
|
157
306
|
## Configuration Options
|
|
158
307
|
|
|
159
308
|
### QoE (Quality of Experience) Settings
|
|
@@ -177,6 +326,10 @@ customData: {
|
|
|
177
326
|
}
|
|
178
327
|
```
|
|
179
328
|
|
|
329
|
+
> **Limit:** The maximum total number of custom attributes per event is **150**. Any attributes beyond this limit will be dropped.
|
|
330
|
+
|
|
331
|
+
> **Note:** There are special reserved keywords used for default attributes (such as `actionName`, `contentBitrate`, `playerName`, `viewSession`, etc.). Please do not use these as custom attribute names, as they will be dropped. See [DATAMODEL.md](./DATAMODEL.md) for the complete list of reserved attribute names.
|
|
332
|
+
|
|
180
333
|
## API Reference
|
|
181
334
|
|
|
182
335
|
### Core Methods
|
|
@@ -259,6 +412,28 @@ player.on('userEngagement', () => {
|
|
|
259
412
|
});
|
|
260
413
|
```
|
|
261
414
|
|
|
415
|
+
## Bitrate Metrics
|
|
416
|
+
|
|
417
|
+
The tracker captures four distinct bitrate metrics providing complete quality analysis:
|
|
418
|
+
|
|
419
|
+
| Attribute | Description | Use Case |
|
|
420
|
+
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
421
|
+
| `contentBitrate` | Encoding bitrate (in bps) of the currently playing rendition from the manifest | Monitor actual video quality being delivered |
|
|
422
|
+
| `contentManifestBitrate` | Maximum available bitrate (in bps) across all renditions in the manifest. Represents the highest quality capability of the stream | Understand maximum quality potential |
|
|
423
|
+
| `contentSegmentDownloadBitrate` | ABR estimated bandwidth (in bps) from the player's stats object, used by the ABR algorithm for quality switching decisions | Analyze ABR decision-making |
|
|
424
|
+
| `contentNetworkDownloadBitrate` | Instantaneous download throughput (in bps) from the most recent segment download. Represents raw network download speed | Monitor real-time network performance |
|
|
425
|
+
|
|
426
|
+
### Bitrate Monitoring Example
|
|
427
|
+
|
|
428
|
+
```javascript
|
|
429
|
+
// All bitrate metrics are automatically captured and sent with each event
|
|
430
|
+
// Access them in New Relic Insights queries:
|
|
431
|
+
|
|
432
|
+
// NRQL Query Examples:
|
|
433
|
+
// SELECT average(contentNetworkDownloadBitrate) FROM VideoAction WHERE actionName = 'CONTENT_HEARTBEAT'
|
|
434
|
+
// SELECT contentBitrate, contentSegmentDownloadBitrate FROM VideoAction WHERE actionName = 'CONTENT_RENDITION_CHANGE'
|
|
435
|
+
```
|
|
436
|
+
|
|
262
437
|
## Ad Tracking Support
|
|
263
438
|
|
|
264
439
|
The tracker provides comprehensive ad tracking capabilities:
|
|
@@ -289,21 +464,12 @@ const tracker = new VideojsTracker(player, options);
|
|
|
289
464
|
|
|
290
465
|
The tracker captures comprehensive video analytics across four event types:
|
|
291
466
|
|
|
292
|
-
- **VideoAction** - Playback events (play, pause, buffer, seek, quality changes)
|
|
467
|
+
- **VideoAction** - Playback events (play, pause, buffer, seek, quality changes, heartbeats)
|
|
293
468
|
- **VideoAdAction** - Ad events (ad start, quartiles, completions, clicks)
|
|
294
|
-
- **VideoErrorAction** - Error events (playback failures, network errors)
|
|
469
|
+
- **VideoErrorAction** - Error events (playback failures, network errors, media errors)
|
|
295
470
|
- **VideoCustomAction** - Custom events defined by your application
|
|
296
471
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
Four distinct bitrate metrics provide complete quality analysis:
|
|
300
|
-
|
|
301
|
-
- `contentBitrate` - Current rendition encoding bitrate
|
|
302
|
-
- `contentManifestBitrate` - Maximum available quality
|
|
303
|
-
- `contentSegmentDownloadBitrate` - ABR bandwidth estimate
|
|
304
|
-
- `contentNetworkDownloadBitrate` - Instantaneous throughput
|
|
305
|
-
|
|
306
|
-
**Full Documentation:** See [datamodel.md](./datamodel.md) for complete event and attribute reference.
|
|
472
|
+
**Full Documentation:** See [DATAMODEL.md](./DATAMODEL.md) for complete event and attribute reference.
|
|
307
473
|
|
|
308
474
|
## Support
|
|
309
475
|
|
|
@@ -320,11 +486,11 @@ If the issue has been confirmed as a bug or is a feature request, please file a
|
|
|
320
486
|
|
|
321
487
|
### Additional Resources
|
|
322
488
|
|
|
323
|
-
- **[
|
|
489
|
+
- **[DATAMODEL.md](./DATAMODEL.md)** - Complete event and attribute reference
|
|
324
490
|
- **[DEVELOPING.md](./DEVELOPING.md)** - Building and testing instructions
|
|
325
491
|
- **[REVIEW.md](./REVIEW.md)** - Code review guidelines
|
|
326
492
|
|
|
327
|
-
##
|
|
493
|
+
## Contribute
|
|
328
494
|
|
|
329
495
|
We encourage your contributions to improve the Video.js Tracker! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
|
|
330
496
|
|
|
@@ -332,14 +498,12 @@ If you have any questions, or to execute our corporate CLA (which is required if
|
|
|
332
498
|
|
|
333
499
|
For more details on how best to contribute, see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
334
500
|
|
|
335
|
-
### A
|
|
501
|
+
### A note about vulnerabilities
|
|
336
502
|
|
|
337
503
|
As noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
|
|
338
504
|
|
|
339
505
|
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through our [bug bounty program](https://docs.newrelic.com/docs/security/security-privacy/information-security/report-security-vulnerabilities/).
|
|
340
506
|
|
|
341
|
-
### Acknowledgments
|
|
342
|
-
|
|
343
507
|
If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).
|
|
344
508
|
|
|
345
509
|
To all contributors, we thank you! Without your contribution, this project would not be what it is today.
|