@24i/bigscreen-sdk 1.0.52 → 1.0.54-alpha.2817

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.52",
3
+ "version": "1.0.54-alpha.2817",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://github.com/24i/smartapps-bigscreen-sdk#readme",
40
40
  "dependencies": {
41
- "@24i/appstage-shared-analytics": "1.0.22",
41
+ "@24i/appstage-shared-analytics": "1.0.24",
42
42
  "@24i/appstage-shared-events-manager": "1.0.11",
43
43
  "@24i/appstage-shared-perf-utils": "1.0.11",
44
44
  "@24i/bigscreen-players-engine-base": "4.1.0",
@@ -31,8 +31,12 @@ export const GOOGLE_ANALYTICS_TRIGGERS = [
31
31
  AnalyticsTriggers.SEARCH,
32
32
  AnalyticsTriggers.RATE_CONTENT,
33
33
  // ads triggers
34
- AnalyticsTriggers.AD_LOADED,
34
+ AnalyticsTriggers.AD_BUFFERING,
35
+ AnalyticsTriggers.AD_COMPLETE,
36
+ AnalyticsTriggers.AD_ERROR,
35
37
  AnalyticsTriggers.AD_SKIPPED,
38
+ AnalyticsTriggers.AD_START,
39
+ AnalyticsTriggers.AD_STOP,
36
40
  // user triggers
37
41
  AnalyticsTriggers.LOGIN,
38
42
  AnalyticsTriggers.LOGOUT,
@@ -87,8 +91,12 @@ export const TRIGGER_NAME_TO_GA_EVENTS: Record<
87
91
  [AnalyticsTriggers.RATE_CONTENT]: ['rate_content'],
88
92
 
89
93
  // ads triggers
90
- [AnalyticsTriggers.AD_LOADED]: ['ad_loaded'],
94
+ [AnalyticsTriggers.AD_BUFFERING]: ['ad_buffering'],
95
+ [AnalyticsTriggers.AD_COMPLETE]: ['ad_complete'],
96
+ [AnalyticsTriggers.AD_ERROR]: ['ad_error'],
91
97
  [AnalyticsTriggers.AD_SKIPPED]: ['ad_skipped'],
98
+ [AnalyticsTriggers.AD_START]: ['ad_start'],
99
+ [AnalyticsTriggers.AD_STOP]: ['ad_stop'],
92
100
 
93
101
  // user triggers
94
102
  [AnalyticsTriggers.LOGIN]: ['login'],
@@ -17,8 +17,12 @@ export type GAEventsNames = (
17
17
  | 'favorite_add' // When a user add asset to favorites
18
18
  | 'favorite_remove' // When a user remove asset froms favorites
19
19
  | 'user_engagement' // Periodically, while the app is in the foreground
20
- | 'ad_loaded' // When advertisement has been loaded
20
+ | 'ad_buffering' // When advertisement is buffering
21
+ | 'ad_complete' // When advertisement has been completed
22
+ | 'ad_error' // When advertisement has an error
21
23
  | 'ad_skipped' // When user skipped current advertisement
24
+ | 'ad_start' // When advertisement has been started
25
+ | 'ad_stop' // When advertisement has been stopped
22
26
  | 'app_exception' // When application throws an error
23
27
  | 'rate_content' // When user rates an asset
24
28
  );
@@ -54,8 +54,12 @@ export const TWENTY_FOUR_IQ_TRIGGERS = [
54
54
  AnalyticsTriggers.SCROLL_90,
55
55
 
56
56
  // Ads
57
- AnalyticsTriggers.AD_LOADED,
57
+ AnalyticsTriggers.AD_BUFFERING,
58
+ AnalyticsTriggers.AD_COMPLETE,
59
+ AnalyticsTriggers.AD_ERROR,
58
60
  AnalyticsTriggers.AD_SKIPPED,
61
+ AnalyticsTriggers.AD_START,
62
+ AnalyticsTriggers.AD_STOP,
59
63
  ];
60
64
 
61
65
  export enum EVENTS {
@@ -69,8 +73,12 @@ export enum EVENTS {
69
73
  PLAYER_CLOSE = 'player_close',
70
74
  PLAYER_OPEN = 'player_open',
71
75
  SCROLL = 'scroll',
72
- AD_LOADED = 'ad_loaded',
76
+ AD_BUFFERING = 'ad_buffering',
77
+ AD_COMPLETE = 'ad_complete',
78
+ AD_ERROR = 'ad_error',
73
79
  AD_SKIPPED = 'ad_skipped',
80
+ AD_START = 'ad_start',
81
+ AD_STOP = 'ad_stop',
74
82
  }
75
83
 
76
84
  export const TRIGGER_NAME_TO_24IQ_EVENTS: { [K in AnalyticsTriggers]?: EVENTS[]; } = {
@@ -92,9 +100,12 @@ export const TRIGGER_NAME_TO_24IQ_EVENTS: { [K in AnalyticsTriggers]?: EVENTS[];
92
100
  [AnalyticsTriggers.SCROLL_75]: [EVENTS.SCROLL],
93
101
  [AnalyticsTriggers.SCROLL_90]: [EVENTS.SCROLL],
94
102
  [AnalyticsTriggers.APP_CLOSE]: [EVENTS.VIDEO_STOP, EVENTS.PLAYER_CLOSE],
95
- // VERSION 2 ?
96
- [AnalyticsTriggers.AD_LOADED]: [EVENTS.AD_LOADED],
103
+ [AnalyticsTriggers.AD_BUFFERING]: [EVENTS.AD_BUFFERING],
104
+ [AnalyticsTriggers.AD_COMPLETE]: [EVENTS.AD_COMPLETE],
105
+ [AnalyticsTriggers.AD_ERROR]: [EVENTS.AD_ERROR],
97
106
  [AnalyticsTriggers.AD_SKIPPED]: [EVENTS.AD_SKIPPED],
107
+ [AnalyticsTriggers.AD_START]: [EVENTS.AD_START],
108
+ [AnalyticsTriggers.AD_STOP]: [EVENTS.AD_STOP],
98
109
  };
99
110
 
100
111
  export const HUNDRED_PERCENT = 100;
@@ -11,8 +11,7 @@ import { mapPlayerOpen } from './mappers/mapPlayerOpen';
11
11
  import { mapPlayerClose } from './mappers/mapPlayerClose';
12
12
  import { mapVideoStart } from './mappers/mapVideoStart';
13
13
  import { mapVideoPause } from './mappers/mapVideoPause';
14
- import { mapAdLoaded } from './mappers/mapAdLoaded';
15
- import { mapAdSkipped } from './mappers/mapAdSkipped';
14
+ import { mapAdEvent } from './mappers/mapAdEvent';
16
15
  import { EventMappingFunction } from './types';
17
16
 
18
17
  export const EVENTS_MAPPING: Record<EVENTS, EventMappingFunction> = {
@@ -26,6 +25,10 @@ export const EVENTS_MAPPING: Record<EVENTS, EventMappingFunction> = {
26
25
  [EVENTS.VIDEO_PROGRESS]: mapVideoProgress,
27
26
  [EVENTS.VIDEO_COMPLETE]: mapVideoComplete,
28
27
  [EVENTS.VIDEO_PAUSE]: mapVideoPause,
29
- [EVENTS.AD_LOADED]: mapAdLoaded,
30
- [EVENTS.AD_SKIPPED]: mapAdSkipped,
28
+ [EVENTS.AD_BUFFERING]: mapAdEvent,
29
+ [EVENTS.AD_COMPLETE]: mapAdEvent,
30
+ [EVENTS.AD_ERROR]: mapAdEvent,
31
+ [EVENTS.AD_SKIPPED]: mapAdEvent,
32
+ [EVENTS.AD_START]: mapAdEvent,
33
+ [EVENTS.AD_STOP]: mapAdEvent,
31
34
  };
@@ -1,16 +1,19 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
- import { Payload, AdSkippedResult } from '../types';
2
+ import { Payload, AdEventResult } from '../types';
3
3
  import { mapBase } from './mapBase';
4
4
 
5
- export const mapAdSkipped = (
5
+ export const mapAdEvent = (
6
6
  triggerName: AnalyticsTriggers,
7
7
  payload: Payload,
8
- ): AdSkippedResult => ({
8
+ ): AdEventResult => ({
9
9
  ...mapBase(payload),
10
10
  action: triggerName,
11
11
  event_trigger: triggerName,
12
+ ad_id: payload.adId || '',
13
+ ad_position: payload.adType || '',
14
+ ad_playback_position: payload.adPosition || '',
15
+ ad_playback_duration: payload.adDuration || '',
12
16
  thing_id: payload.assetId || '',
13
17
  attribution_id: payload.attributionId || '',
14
- player_advertisment_name: '', // TODO: adPayload?.adName,
15
- player_advertisment_position: 0, // TODO: adPayload?.adPosition,
18
+ custom_campaign_url: '',
16
19
  });
@@ -1,6 +1,6 @@
1
1
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
2
2
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
3
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
3
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
4
4
  import { PlayerCloseResult, Payload } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -16,6 +16,7 @@ export const mapPlayerClose = (
16
16
  ...mapBase(payload),
17
17
  action: EVENTS.PLAYER_CLOSE,
18
18
  event_trigger: triggerName,
19
+ source_page: DefaultScreens.PLAYBACK,
19
20
  thing_id: payload.assetId || '',
20
21
  attribution_id: payload.attributionId || '',
21
22
  duration,
@@ -1,6 +1,6 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
- import { EVENTS } from '../constants';
3
+ import { DefaultScreens, EVENTS } from '../constants';
4
4
  import { Payload, VideoCompleteResult } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -17,5 +17,6 @@ export const mapVideoComplete = (
17
17
  attribution_id: payload.attributionId || '',
18
18
  progress_pct: 90,
19
19
  duration: assetDuration,
20
+ source_page: DefaultScreens.PLAYBACK,
20
21
  };
21
22
  };
@@ -1,6 +1,6 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
3
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
4
4
  import { VideoPauseResult, Payload } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -20,5 +20,6 @@ export const mapVideoPause = (
20
20
  attribution_id: payload.attributionId || '',
21
21
  duration: overallDuration,
22
22
  progress_pct: progressPercent,
23
+ source_page: DefaultScreens.PLAYBACK,
23
24
  };
24
25
  };
@@ -1,7 +1,7 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
3
  import { Payload, VideoProgressResult } from '../types';
4
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
4
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
5
5
  import { mapBase } from './mapBase';
6
6
 
7
7
  export const mapVideoProgress = (
@@ -20,5 +20,6 @@ export const mapVideoProgress = (
20
20
  attribution_id: payload.attributionId || '',
21
21
  progress_pct: progressPercent,
22
22
  duration: durationInSeconds,
23
+ source_page: DefaultScreens.PLAYBACK,
23
24
  };
24
25
  };
@@ -1,6 +1,6 @@
1
1
  import { Asset } from '@24i/smartapps-datalayer/models';
2
2
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
3
- import type { AnyPayload, UserInfo, AppInfo } from '../../interface';
3
+ import type { AnyPayload, UserInfo, AppInfo, AdType } from '../../interface';
4
4
 
5
5
  interface ScreenParams {
6
6
  screen: string;
@@ -37,7 +37,20 @@ export interface SceneInfo {
37
37
  sceneType?: string,
38
38
  }
39
39
 
40
- export type Payload = CorePayload & SceneInfo & SessionInfo & UserInfo & DeviceInfo & AppInfo;
40
+ export interface AdInfo {
41
+ adId: string;
42
+ adType: AdType;
43
+ adDuration: string;
44
+ adPosition: string;
45
+ }
46
+
47
+ export type Payload = CorePayload
48
+ & SceneInfo
49
+ & SessionInfo
50
+ & UserInfo
51
+ & DeviceInfo
52
+ & AppInfo
53
+ & AdInfo;
41
54
 
42
55
  export type EventBody = AnyPayload;
43
56
 
@@ -74,13 +87,6 @@ export type BufferingResult = SceneViewResult;
74
87
  export type ScrollResult = SceneViewResult & {
75
88
  percent_scrolled: string;
76
89
  };
77
- export type VideoProgressResult = CoreResult & {
78
- thing_id: string;
79
- attribution_id: string;
80
- progress_pct: number;
81
- duration: number;
82
- };
83
-
84
90
  export type PlayerOpenResult = CoreResult & {
85
91
  thing_id: string;
86
92
  attribution_id: string;
@@ -88,36 +94,34 @@ export type PlayerOpenResult = CoreResult & {
88
94
  source_rail?: string | null;
89
95
  };
90
96
 
91
- export type VideoStartResult = CoreResult & {
97
+ export type VideoBaseResult = CoreResult & {
92
98
  thing_id: string;
93
99
  attribution_id: string;
94
100
  duration: number;
95
101
  progress_pct: number;
96
102
  source_page: string;
97
- source_rail?: string | null;
98
103
  };
99
104
 
100
- export type VideoPauseResult = CoreResult & {
101
- thing_id: string;
102
- attribution_id: string;
103
- duration: number;
104
- progress_pct: number;
105
+ export type VideoStartResult = VideoBaseResult & {
106
+ source_rail?: string | null;
105
107
  };
106
108
 
107
- export type AdLoadedResult = CoreResult & {
108
- thing_id: string;
109
- attribution_id: string;
110
- player_advertisment_name: string;
111
- player_advertisment_position: number;
112
- };
109
+ export type VideoPauseResult = VideoBaseResult;
110
+
111
+ export type VideoStopResult = VideoStartResult;
112
+
113
+ export type VideoProgressResult = VideoBaseResult;
114
+
115
+ export type VideoCompleteResult = VideoBaseResult;
113
116
 
114
- export type AdSkippedResult = CoreResult & {
117
+ export type PlayerCloseResult = VideoBaseResult;
118
+
119
+ export type AdEventResult = CoreResult & {
120
+ ad_id: string;
121
+ ad_position: AdType;
122
+ ad_playback_position: string;
123
+ ad_playback_duration: string;
115
124
  thing_id: string;
116
125
  attribution_id: string;
117
- player_advertisment_name: string;
118
- player_advertisment_position: number;
126
+ custom_campaign_url: string;
119
127
  };
120
-
121
- export type VideoCompleteResult = VideoPauseResult;
122
- export type VideoStopResult = VideoStartResult;
123
- export type PlayerCloseResult = VideoPauseResult;
@@ -1,13 +0,0 @@
1
- import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
- import { Payload, AdLoadedResult } from '../types';
3
- import { mapBase } from './mapBase';
4
-
5
- export const mapAdLoaded = (triggerName: AnalyticsTriggers, payload: Payload): AdLoadedResult => ({
6
- ...mapBase(payload),
7
- action: triggerName,
8
- event_trigger: triggerName,
9
- thing_id: payload.assetId || '',
10
- attribution_id: payload.attributionId || '',
11
- player_advertisment_name: '', // TODO: adPayload?.adName,
12
- player_advertisment_position: 0, // TODO: adPayload?.adPosition,
13
- });