@24i/bigscreen-sdk 1.0.42-alpha.2709 → 1.0.42
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 +2 -2
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +9 -13
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +1 -0
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +1 -0
- package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +1 -1
- package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +5 -1
- package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +3 -1
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +1 -1
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.42
|
|
3
|
+
"version": "1.0.42",
|
|
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.
|
|
41
|
+
"@24i/appstage-shared-analytics": "1.0.22",
|
|
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.0.10",
|
|
@@ -5,7 +5,7 @@ import { createTimeout } from '@24i/bigscreen-sdk/utils/timers';
|
|
|
5
5
|
import { MINUTE_IN_MS } from '@24i/bigscreen-sdk/utils/timeConstants';
|
|
6
6
|
import { generateUuid } from '@24i/bigscreen-sdk/utils/generateUuid';
|
|
7
7
|
import { i18n } from '@24i/bigscreen-sdk/i18n';
|
|
8
|
-
import type { AnalyticsClient, AnalyticsEventsMap,
|
|
8
|
+
import type { AnalyticsClient, AnalyticsEventsMap, AnyPayload } from '../../interface';
|
|
9
9
|
import { mapEventParamsToUrlParams, mapPayload } from './mapPayload';
|
|
10
10
|
import { prepareBody } from './prepareBody';
|
|
11
11
|
import { getUrl } from './getUrl';
|
|
@@ -123,18 +123,10 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
123
123
|
this.lastOnEvent = now;
|
|
124
124
|
await Promise.all(events.map(async (event, index) => {
|
|
125
125
|
const sessionInfo = await this.getSessionInfo(
|
|
126
|
-
index === 0 ? engagementTime : undefined,
|
|
126
|
+
payload!, index === 0 ? engagementTime : undefined,
|
|
127
127
|
);
|
|
128
|
-
const gtagPayload = mapPayload(
|
|
129
|
-
|
|
130
|
-
...payload,
|
|
131
|
-
...sessionInfo,
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
const urlParams = mapEventParamsToUrlParams({
|
|
135
|
-
...sessionInfo as SessionInfo,
|
|
136
|
-
...payload as SceneInfo,
|
|
137
|
-
});
|
|
128
|
+
const gtagPayload = mapPayload(event, triggerName, { ...payload, ...sessionInfo });
|
|
129
|
+
const urlParams = mapEventParamsToUrlParams({ ...sessionInfo, ...payload });
|
|
138
130
|
this.send(event, gtagPayload, urlParams);
|
|
139
131
|
}));
|
|
140
132
|
}
|
|
@@ -177,7 +169,10 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
177
169
|
|
|
178
170
|
private sendQueueWithDelay = debounce(this.sendQueue, SEND_DEBOUNCE_MS);
|
|
179
171
|
|
|
180
|
-
private async getSessionInfo(
|
|
172
|
+
private async getSessionInfo(
|
|
173
|
+
payload: AnyPayload,
|
|
174
|
+
engagementTime: number | undefined,
|
|
175
|
+
): Promise<SessionInfo> {
|
|
181
176
|
const sessionStarted = !this.sessionStartSent;
|
|
182
177
|
this.sessionStartSent = true;
|
|
183
178
|
const { firstEvent } = this;
|
|
@@ -194,6 +189,7 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
194
189
|
sessionStarted,
|
|
195
190
|
engagementTime,
|
|
196
191
|
firstEvent,
|
|
192
|
+
isAuthenticated: payload?.userId ? '1' : '0',
|
|
197
193
|
firstVisit: firstVisit as boolean,
|
|
198
194
|
};
|
|
199
195
|
}
|
|
@@ -103,7 +103,7 @@ export class TealiumAnalytics implements AnalyticsClient {
|
|
|
103
103
|
platform_type: platformType ?? BIGSCREEN_PLATFORM_TYPE,
|
|
104
104
|
app_type: appType ?? BIGSCREEN_APP_TYPE,
|
|
105
105
|
ott_type: BIGSCREEN_OTT_TYPE,
|
|
106
|
-
app_id: `${entity} ${
|
|
106
|
+
app_id: `${entity} ${appType ?? BIGSCREEN_APP_TYPE} : ${this.appVersion}`,
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -10,6 +10,7 @@ export const BIGSCREEN_PLATFORM_TYPE = 'ott';
|
|
|
10
10
|
|
|
11
11
|
export const TEALIUM_TRIGGERS = [
|
|
12
12
|
// App
|
|
13
|
+
AnalyticsTriggers.APP_OPEN,
|
|
13
14
|
AnalyticsTriggers.APP_CLOSE,
|
|
14
15
|
AnalyticsTriggers.APP_ERROR,
|
|
15
16
|
|
|
@@ -42,6 +43,7 @@ export const TEALIUM_TRIGGERS = [
|
|
|
42
43
|
];
|
|
43
44
|
|
|
44
45
|
export const AppEvents = {
|
|
46
|
+
[AnalyticsTriggers.APP_OPEN]: '',
|
|
45
47
|
[AnalyticsTriggers.SCENE_VIEW]: '',
|
|
46
48
|
[AnalyticsTriggers.PLAYBACK_10]: 'media_milestone_10_video',
|
|
47
49
|
[AnalyticsTriggers.PLAYBACK_50]: 'media_milestone_50_video',
|
|
@@ -50,7 +52,7 @@ export const AppEvents = {
|
|
|
50
52
|
[AnalyticsTriggers.PLAYBACK_PAUSE]: 'video_pause',
|
|
51
53
|
[AnalyticsTriggers.PLAYBACK_UNPAUSE]: 'video_resume',
|
|
52
54
|
[AnalyticsTriggers.PLAYBACK_START]: 'video_play',
|
|
53
|
-
[AnalyticsTriggers.PLAYER_OPEN]: '
|
|
55
|
+
[AnalyticsTriggers.PLAYER_OPEN]: 'player_open',
|
|
54
56
|
[AnalyticsTriggers.PLAYER_CLOSE]: 'player_x',
|
|
55
57
|
[AnalyticsTriggers.FAVORITE_ADD]: 'subscribe_to_fav',
|
|
56
58
|
[AnalyticsTriggers.FAVORITE_REMOVE]: 'subscribe_to_fav',
|
|
@@ -61,6 +63,7 @@ export const AppEvents = {
|
|
|
61
63
|
} as const;
|
|
62
64
|
|
|
63
65
|
export enum EVENTS {
|
|
66
|
+
APP_OPEN = 'app_open',
|
|
64
67
|
SCENE_VIEW = 'scene_view',
|
|
65
68
|
VIDEO_PROGRESS = 'video_progress',
|
|
66
69
|
VIDEO_START = 'video_start',
|
|
@@ -82,6 +85,7 @@ export enum TrackEventType {
|
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
export const TRIGGER_NAME_TO_TEALIUM_EVENTS: { [K in AnalyticsTriggers]?: EVENTS[]; } = {
|
|
88
|
+
[AnalyticsTriggers.APP_OPEN]: [EVENTS.APP_OPEN],
|
|
85
89
|
[AnalyticsTriggers.SCENE_VIEW]: [EVENTS.SCENE_VIEW],
|
|
86
90
|
[AnalyticsTriggers.PLAYBACK_10]: [EVENTS.VIDEO_PROGRESS],
|
|
87
91
|
[AnalyticsTriggers.PLAYBACK_50]: [EVENTS.VIDEO_PROGRESS],
|
|
@@ -13,10 +13,12 @@ import { mapFavoriteRemove } from './mappers/mapFavoriteRemove';
|
|
|
13
13
|
import { mapVideoResume } from './mappers/mapVideoResume';
|
|
14
14
|
import { mapSearchSuccess } from './mappers/mapSearchSuccess';
|
|
15
15
|
import { mapSearchFailed } from './mappers/mapSearchFailed';
|
|
16
|
-
import { EventMappingFunction } from './types';
|
|
17
16
|
import { mapAppError } from './mappers/mapAppError';
|
|
17
|
+
import { mapAppOpen } from './mappers/mapAppOpen';
|
|
18
|
+
import { EventMappingFunction } from './types';
|
|
18
19
|
|
|
19
20
|
export const EVENTS_MAPPING: Record<EVENTS, EventMappingFunction> = {
|
|
21
|
+
[EVENTS.APP_OPEN]: mapAppOpen,
|
|
20
22
|
[EVENTS.SCENE_VIEW]: mapSceneView,
|
|
21
23
|
[EVENTS.PLAYER_OPEN]: mapPlayerOpen,
|
|
22
24
|
[EVENTS.PLAYER_CLOSE]: mapPlayerClose,
|
|
@@ -45,7 +45,7 @@ export const TEALIUM_STATIC_CORE_PAYLOAD = {
|
|
|
45
45
|
tealium_profile: 'main',
|
|
46
46
|
tealium_environment: 'dev',
|
|
47
47
|
tealium_datasource: 'abc',
|
|
48
|
-
app_id: 'auto
|
|
48
|
+
app_id: 'auto html5 : v1.0-test',
|
|
49
49
|
app_type: 'html5',
|
|
50
50
|
entity: 'auto',
|
|
51
51
|
language: 'english',
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
|
|
2
|
+
import { TeaSceneViewResult } from '../types';
|
|
3
|
+
import { TrackEventType } from '../constants';
|
|
4
|
+
|
|
5
|
+
export const mapAppOpen = (): Omit<TeaSceneViewResult, 'categories'> => ({
|
|
6
|
+
event_trigger: AnalyticsTriggers.SCENE_VIEW,
|
|
7
|
+
track_event_type: TrackEventType.VIEW,
|
|
8
|
+
page_title: 'app open',
|
|
9
|
+
page_name: 'app open',
|
|
10
|
+
content_type: 'onboarding',
|
|
11
|
+
section: 'onboarding',
|
|
12
|
+
subcontent_type: 'welcomeScreen',
|
|
13
|
+
});
|