@24i/bigscreen-sdk 1.0.14-alpha.2286 → 1.0.15-alpha.2292
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 +1 -1
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +8 -2
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +3 -2
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +3 -2
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +1 -3
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { debounce } from '@24i/bigscreen-sdk/utils/debounce';
|
|
|
4
4
|
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
|
+
import { i18n } from '@24i/bigscreen-sdk/i18n';
|
|
7
8
|
import type { AnalyticsClient, AnalyticsEventsMap, SceneInfo } from '../../interface';
|
|
8
9
|
import { mapEventParamsToUrlParams, mapPayload } from './mapPayload';
|
|
9
10
|
import { prepareBody } from './prepareBody';
|
|
@@ -33,7 +34,6 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
33
34
|
constantUrlParams: ConstantUrlParams = {
|
|
34
35
|
cid: '',
|
|
35
36
|
sid: 0,
|
|
36
|
-
uamb: 0,
|
|
37
37
|
seg: 0,
|
|
38
38
|
sct: 0,
|
|
39
39
|
_p: generateUuid(),
|
|
@@ -131,7 +131,10 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
131
131
|
...sessionInfo,
|
|
132
132
|
},
|
|
133
133
|
);
|
|
134
|
-
const urlParams = mapEventParamsToUrlParams(
|
|
134
|
+
const urlParams = mapEventParamsToUrlParams({
|
|
135
|
+
...sessionInfo as SessionInfo,
|
|
136
|
+
...payload as SceneInfo,
|
|
137
|
+
});
|
|
135
138
|
this.send(event, gtagPayload, urlParams);
|
|
136
139
|
}));
|
|
137
140
|
}
|
|
@@ -184,6 +187,9 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
184
187
|
return {
|
|
185
188
|
appVersion: this.appVersion,
|
|
186
189
|
manufacturer: this.manufacturer,
|
|
190
|
+
language: i18n.getLanguage(),
|
|
191
|
+
resolution: `${window.screen.width}x${window.screen.height}`,
|
|
192
|
+
referrer: document.referrer,
|
|
187
193
|
platform: this.platform,
|
|
188
194
|
sessionStarted,
|
|
189
195
|
engagementTime,
|
|
@@ -95,8 +95,9 @@ export const TRIGGER_NAME_TO_GA_EVENTS: Record<
|
|
|
95
95
|
|
|
96
96
|
export const gtagPayloadParams: Record<string, string> = {
|
|
97
97
|
contentType: `${stringParameter}.content_type`,
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
itemId: `${stringParameter}.video_asset_id`,
|
|
99
|
+
episodeNumber: `${numericParameter}.video_episode_number`,
|
|
100
|
+
seasonNumber: `${numericParameter}.video_season_number`,
|
|
100
101
|
currentTime: `${numericParameter}.video_current_time`,
|
|
101
102
|
duration: `${numericParameter}.video_duration`,
|
|
102
103
|
percent: `${numericParameter}.video_percent`,
|
|
@@ -26,6 +26,9 @@ export type SessionInfo = {
|
|
|
26
26
|
appVersion: string,
|
|
27
27
|
manufacturer: string,
|
|
28
28
|
platform: string,
|
|
29
|
+
language: string,
|
|
30
|
+
resolution: string,
|
|
31
|
+
referrer: string,
|
|
29
32
|
engagementTime: number | undefined,
|
|
30
33
|
sessionStarted: boolean,
|
|
31
34
|
firstEvent: boolean,
|
|
@@ -37,8 +40,6 @@ export type ConstantUrlParams = {
|
|
|
37
40
|
cid: string,
|
|
38
41
|
/** Session ID (random number) */
|
|
39
42
|
sid: number,
|
|
40
|
-
/** 1 for mobile devices, 0 otherwise */
|
|
41
|
-
uamb: number,
|
|
42
43
|
/** Session engagement 0 for first event of session, 1 otherwise */
|
|
43
44
|
seg: number,
|
|
44
45
|
/** Session count */
|
|
@@ -5,6 +5,7 @@ import { gtagPayloadParams } from './constants';
|
|
|
5
5
|
const map: Record<string, string> = {
|
|
6
6
|
language: 'ul',
|
|
7
7
|
resolution: 'sr',
|
|
8
|
+
referrer: 'dr',
|
|
8
9
|
sceneId: 'dl',
|
|
9
10
|
sceneName: 'dt',
|
|
10
11
|
};
|
|
@@ -30,9 +31,6 @@ export const mapPayload = (
|
|
|
30
31
|
const gtagPayload: Record<string, any> = {
|
|
31
32
|
'ep.event_trigger': triggerName,
|
|
32
33
|
_et: payload.engagementTime ?? 0,
|
|
33
|
-
_ee: payload.firstEvent ? 1 : 0,
|
|
34
|
-
_fv: payload.firstVisit ? 1 : 0,
|
|
35
|
-
_ss: payload.sessionStarted ? 1 : 0,
|
|
36
34
|
};
|
|
37
35
|
if (eventName === 'scroll') {
|
|
38
36
|
gtagPayload['epn.percent_scrolled'] = parseInt(triggerName.split('_')[1], 10);
|