@streamlayer/sdk-web-analytics 1.12.9 → 1.13.0
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/lib/advertisement.d.ts +5 -0
- package/lib/advertisement.js +97 -13
- package/lib/analytics.js +11 -2
- package/package.json +8 -8
package/lib/advertisement.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export declare const getPromotionSubType: (type?: PromotionType) => TopicSubType
|
|
|
9
9
|
export declare class AdvertisementAnalytics {
|
|
10
10
|
private analytics;
|
|
11
11
|
constructor(analytics: Analytics);
|
|
12
|
+
exposedPauseAdEnabled: ({ id }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
13
|
+
exposedPauseAdClosed: ({ id }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
14
|
+
exposedPauseAdDisabled: ({ id }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
15
|
+
exposedPauseAdOpened: ({ id }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
16
|
+
exposedPauseAdLoad: ({ id }: EventBusActionPayload["exposedPauseAd"], loaded: boolean) => void;
|
|
12
17
|
received: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
13
18
|
opened: ({ id, openedFrom }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
14
19
|
viewed: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
package/lib/advertisement.js
CHANGED
|
@@ -43,48 +43,72 @@ export class AdvertisementAnalytics {
|
|
|
43
43
|
if (event.slEventBus?.skipAnalytics) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
if (event.slEventBus?.type === 'exposedPauseAd') {
|
|
47
|
+
const payload = event.slEventBus.payload;
|
|
48
|
+
switch (event.slEventBus.action) {
|
|
49
|
+
case 'enabled':
|
|
50
|
+
this.exposedPauseAdEnabled(payload);
|
|
51
|
+
break;
|
|
52
|
+
case 'disabled':
|
|
53
|
+
this.exposedPauseAdDisabled(payload);
|
|
54
|
+
break;
|
|
55
|
+
case 'closed':
|
|
56
|
+
this.exposedPauseAdClosed(payload);
|
|
57
|
+
break;
|
|
58
|
+
case 'load':
|
|
59
|
+
this.exposedPauseAdLoad(payload, false);
|
|
60
|
+
break;
|
|
61
|
+
case 'loaded':
|
|
62
|
+
this.exposedPauseAdLoad(payload, true);
|
|
63
|
+
break;
|
|
64
|
+
case 'rendered':
|
|
65
|
+
this.exposedPauseAdOpened(payload);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
46
69
|
if (event.slEventBus?.type === 'advertisement') {
|
|
47
|
-
const
|
|
70
|
+
const payload = event.slEventBus.payload;
|
|
71
|
+
const topicSubType = getPromotionSubType(payload.type);
|
|
48
72
|
switch (event.slEventBus.action) {
|
|
49
73
|
case 'videoPlay':
|
|
50
|
-
this.videoPlay(
|
|
74
|
+
this.videoPlay(payload, { topicSubType });
|
|
51
75
|
break;
|
|
52
76
|
case 'videoEnd':
|
|
53
|
-
this.videoEnd(
|
|
77
|
+
this.videoEnd(payload, { topicSubType });
|
|
54
78
|
break;
|
|
55
79
|
case 'videoRendered':
|
|
56
|
-
this.videoRendered(
|
|
80
|
+
this.videoRendered(payload, { topicSubType });
|
|
57
81
|
break;
|
|
58
82
|
case 'buttonSelect':
|
|
59
|
-
this.buttonSelect(
|
|
83
|
+
this.buttonSelect(payload, { topicSubType });
|
|
60
84
|
break;
|
|
61
85
|
case 'bannerSelect':
|
|
62
|
-
this.bannerSelect(
|
|
86
|
+
this.bannerSelect(payload, { topicSubType });
|
|
63
87
|
break;
|
|
64
88
|
case 'bannerShown':
|
|
65
|
-
this.bannerShown(
|
|
89
|
+
this.bannerShown(payload, { topicSubType });
|
|
66
90
|
break;
|
|
67
91
|
case 'received':
|
|
68
|
-
this.received(
|
|
92
|
+
this.received(payload, { topicSubType });
|
|
69
93
|
break;
|
|
70
94
|
case 'opened':
|
|
71
|
-
this.opened(
|
|
95
|
+
this.opened(payload, { topicSubType });
|
|
72
96
|
break;
|
|
73
97
|
case 'viewed':
|
|
74
|
-
this.viewed(
|
|
98
|
+
this.viewed(payload, { topicSubType });
|
|
75
99
|
break;
|
|
76
100
|
case 'videoMuted':
|
|
77
101
|
case 'videoUnmuted':
|
|
78
|
-
this.videoMuted(
|
|
102
|
+
this.videoMuted(payload, {
|
|
79
103
|
topicSubType,
|
|
80
104
|
muted: event.slEventBus.action === 'videoMuted',
|
|
81
105
|
});
|
|
82
106
|
break;
|
|
83
107
|
case 'videoReplayed':
|
|
84
|
-
this.videoReplayed(
|
|
108
|
+
this.videoReplayed(payload, { topicSubType });
|
|
85
109
|
break;
|
|
86
110
|
case 'quartileCompleted':
|
|
87
|
-
this.quartileCompleted(
|
|
111
|
+
this.quartileCompleted(payload, { topicSubType });
|
|
88
112
|
break;
|
|
89
113
|
}
|
|
90
114
|
}
|
|
@@ -92,6 +116,66 @@ export class AdvertisementAnalytics {
|
|
|
92
116
|
return eventBus.listen(listener);
|
|
93
117
|
});
|
|
94
118
|
}
|
|
119
|
+
exposedPauseAdEnabled = ({ id }) => {
|
|
120
|
+
const values = this.analytics.commonStore.getValues();
|
|
121
|
+
this.analytics.write('games', {
|
|
122
|
+
common: {
|
|
123
|
+
...values,
|
|
124
|
+
kind: Kind.STREAM_PAUSED,
|
|
125
|
+
topicId: id ?? values.topicId,
|
|
126
|
+
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
127
|
+
},
|
|
128
|
+
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
exposedPauseAdClosed = ({ id }) => {
|
|
132
|
+
const values = this.analytics.commonStore.getValues();
|
|
133
|
+
this.analytics.write('games', {
|
|
134
|
+
common: {
|
|
135
|
+
...values,
|
|
136
|
+
kind: Kind.EXTERNAL_AD_CLOSED,
|
|
137
|
+
topicId: id ?? values.topicId,
|
|
138
|
+
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
139
|
+
},
|
|
140
|
+
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
exposedPauseAdDisabled = ({ id }) => {
|
|
144
|
+
const values = this.analytics.commonStore.getValues();
|
|
145
|
+
this.analytics.write('games', {
|
|
146
|
+
common: {
|
|
147
|
+
...values,
|
|
148
|
+
kind: Kind.STREAM_RESUMED,
|
|
149
|
+
topicId: id ?? values.topicId,
|
|
150
|
+
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
151
|
+
},
|
|
152
|
+
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
exposedPauseAdOpened = ({ id }) => {
|
|
156
|
+
const values = this.analytics.commonStore.getValues();
|
|
157
|
+
this.analytics.write('games', {
|
|
158
|
+
common: {
|
|
159
|
+
...values,
|
|
160
|
+
kind: Kind.EXTERNAL_AD_RENDERED,
|
|
161
|
+
topicId: id ?? values.topicId,
|
|
162
|
+
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
163
|
+
},
|
|
164
|
+
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
exposedPauseAdLoad = ({ id }, loaded) => {
|
|
168
|
+
const values = this.analytics.commonStore.getValues();
|
|
169
|
+
this.analytics.write('games', {
|
|
170
|
+
common: {
|
|
171
|
+
...values,
|
|
172
|
+
kind: !loaded ? Kind.EXTERNAL_AD_REQUESTED : Kind.EXTERNAL_AD_LOADED,
|
|
173
|
+
topicId: id ?? values.topicId,
|
|
174
|
+
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
175
|
+
},
|
|
176
|
+
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
177
|
+
});
|
|
178
|
+
};
|
|
95
179
|
received = ({ id }, { topicSubType }) => {
|
|
96
180
|
this.analytics.write('games', {
|
|
97
181
|
common: {
|
package/lib/analytics.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createMapStore, MapStore, eventBus, } from '@streamlayer/sdk-web-interf
|
|
|
2
2
|
import { FeatureType } from '@streamlayer/sdk-web-types';
|
|
3
3
|
import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
|
-
import { ScreenOrientation } from '@streamlayer/sl-eslib/analytics/v1/common/analytics.common_pb';
|
|
5
|
+
import { Category, ScreenOrientation, TopicType } from '@streamlayer/sl-eslib/analytics/v1/common/analytics.common_pb';
|
|
6
6
|
import { AnalyticsService, } from '@streamlayer/sl-eslib/analytics/v2/streaming/streaming_pb';
|
|
7
7
|
import { InvitationAnalytics } from './invitation';
|
|
8
8
|
import { InteractionsAnalytics } from './interactions';
|
|
@@ -112,11 +112,20 @@ export class Analytics {
|
|
|
112
112
|
}
|
|
113
113
|
const action = event.slEventBus?.action;
|
|
114
114
|
if (event.slEventBus?.type === 'exposedPauseAd') {
|
|
115
|
+
const payload = event.slEventBus.payload;
|
|
115
116
|
if (action === 'disabled') {
|
|
116
117
|
this.writeCommon('overlaySessionId', '');
|
|
118
|
+
this.writeCommon('topicId', '');
|
|
119
|
+
this.writeCommon('topicType', TopicType.UNSET);
|
|
120
|
+
this.writeCommon('category', Category.UNSET);
|
|
117
121
|
}
|
|
118
|
-
if (action === '
|
|
122
|
+
if (action === 'enabled') {
|
|
119
123
|
this.writeCommon('overlaySessionId', v4());
|
|
124
|
+
this.writeCommon('category', Category.EXPOSED_PAUSED_AD);
|
|
125
|
+
}
|
|
126
|
+
if (action === 'loaded' && payload.id) {
|
|
127
|
+
this.writeCommon('topicId', payload.id);
|
|
128
|
+
this.writeCommon('topicType', TopicType.UNSET);
|
|
120
129
|
}
|
|
121
130
|
}
|
|
122
131
|
if (event.slEventBus?.type === 'advertisement') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/sdk-web-analytics",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"@bufbuild/protobuf": "^2.2.2",
|
|
13
13
|
"@connectrpc/connect": "^2.0.0",
|
|
14
14
|
"uuid": "^11.1.0",
|
|
15
|
-
"@streamlayer/sl-eslib": "^5.
|
|
16
|
-
"@streamlayer/sdk-web-
|
|
17
|
-
"@streamlayer/sdk-web-
|
|
18
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
19
|
-
"@streamlayer/sdk-web-features": "^1.0.
|
|
20
|
-
"@streamlayer/sdk-web-core": "^1.
|
|
21
|
-
"@streamlayer/feature-gamification": "^1.
|
|
15
|
+
"@streamlayer/sl-eslib": "^5.225.0",
|
|
16
|
+
"@streamlayer/sdk-web-api": "^1.14.0",
|
|
17
|
+
"@streamlayer/sdk-web-interfaces": "^1.8.0",
|
|
18
|
+
"@streamlayer/sdk-web-logger": "^1.0.85",
|
|
19
|
+
"@streamlayer/sdk-web-features": "^1.0.85",
|
|
20
|
+
"@streamlayer/sdk-web-core": "^1.17.0",
|
|
21
|
+
"@streamlayer/feature-gamification": "^1.23.0"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|