@streamlayer/sdk-web-analytics 1.14.2 → 1.15.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 -5
- package/lib/advertisement.js +15 -10
- package/lib/analytics.js +2 -6
- package/lib/heartbeat.js +2 -2
- package/package.json +8 -8
package/lib/advertisement.d.ts
CHANGED
|
@@ -9,11 +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
|
+
exposedPauseAdEnabled: ({ id, parentId }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
13
|
+
exposedPauseAdClosed: ({ id, parentId }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
14
|
+
exposedPauseAdDisabled: ({ id, parentId }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
15
|
+
exposedPauseAdOpened: ({ id, parentId }: EventBusActionPayload["exposedPauseAd"]) => void;
|
|
16
|
+
exposedPauseAdLoad: ({ id, parentId }: EventBusActionPayload["exposedPauseAd"], loaded: boolean) => void;
|
|
17
17
|
received: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
18
18
|
opened: ({ id, openedFrom }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
19
19
|
viewed: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
package/lib/advertisement.js
CHANGED
|
@@ -116,61 +116,66 @@ export class AdvertisementAnalytics {
|
|
|
116
116
|
return eventBus.listen(listener);
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
exposedPauseAdEnabled = ({ id }) => {
|
|
119
|
+
exposedPauseAdEnabled = ({ id, parentId }) => {
|
|
120
120
|
const values = this.analytics.commonStore.getValues();
|
|
121
121
|
this.analytics.write('games', {
|
|
122
122
|
common: {
|
|
123
123
|
...values,
|
|
124
124
|
kind: Kind.STREAM_PAUSED,
|
|
125
|
-
topicId: id
|
|
125
|
+
topicId: id,
|
|
126
|
+
parentTopicId: parentId,
|
|
126
127
|
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
127
128
|
},
|
|
128
129
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
129
130
|
});
|
|
130
131
|
};
|
|
131
|
-
exposedPauseAdClosed = ({ id }) => {
|
|
132
|
+
exposedPauseAdClosed = ({ id, parentId }) => {
|
|
132
133
|
const values = this.analytics.commonStore.getValues();
|
|
133
134
|
this.analytics.write('games', {
|
|
134
135
|
common: {
|
|
135
136
|
...values,
|
|
136
137
|
kind: Kind.EXTERNAL_AD_CLOSED,
|
|
137
|
-
topicId: id
|
|
138
|
+
topicId: id,
|
|
139
|
+
parentTopicId: parentId,
|
|
138
140
|
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
139
141
|
},
|
|
140
142
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
141
143
|
});
|
|
142
144
|
};
|
|
143
|
-
exposedPauseAdDisabled = ({ id }) => {
|
|
145
|
+
exposedPauseAdDisabled = ({ id, parentId }) => {
|
|
144
146
|
const values = this.analytics.commonStore.getValues();
|
|
145
147
|
this.analytics.write('games', {
|
|
146
148
|
common: {
|
|
147
149
|
...values,
|
|
148
150
|
kind: Kind.STREAM_RESUMED,
|
|
149
|
-
topicId: id
|
|
151
|
+
topicId: id,
|
|
152
|
+
parentTopicId: parentId,
|
|
150
153
|
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
151
154
|
},
|
|
152
155
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
153
156
|
});
|
|
154
157
|
};
|
|
155
|
-
exposedPauseAdOpened = ({ id }) => {
|
|
158
|
+
exposedPauseAdOpened = ({ id, parentId }) => {
|
|
156
159
|
const values = this.analytics.commonStore.getValues();
|
|
157
160
|
this.analytics.write('games', {
|
|
158
161
|
common: {
|
|
159
162
|
...values,
|
|
160
163
|
kind: Kind.EXTERNAL_AD_RENDERED,
|
|
161
|
-
topicId: id
|
|
164
|
+
topicId: id,
|
|
165
|
+
parentTopicId: parentId,
|
|
162
166
|
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
163
167
|
},
|
|
164
168
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
165
169
|
});
|
|
166
170
|
};
|
|
167
|
-
exposedPauseAdLoad = ({ id }, loaded) => {
|
|
171
|
+
exposedPauseAdLoad = ({ id, parentId }, loaded) => {
|
|
168
172
|
const values = this.analytics.commonStore.getValues();
|
|
169
173
|
this.analytics.write('games', {
|
|
170
174
|
common: {
|
|
171
175
|
...values,
|
|
172
176
|
kind: !loaded ? Kind.EXTERNAL_AD_REQUESTED : Kind.EXTERNAL_AD_LOADED,
|
|
173
|
-
topicId: id
|
|
177
|
+
topicId: id,
|
|
178
|
+
parentTopicId: parentId,
|
|
174
179
|
topicType: TopicType.EXPOSED_PAUSED_AD,
|
|
175
180
|
},
|
|
176
181
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
package/lib/analytics.js
CHANGED
|
@@ -112,12 +112,12 @@ export class Analytics {
|
|
|
112
112
|
}
|
|
113
113
|
const action = event.slEventBus?.action;
|
|
114
114
|
if (event.slEventBus?.type === 'exposedPauseAd') {
|
|
115
|
-
|
|
116
|
-
if (action === 'disabled') {
|
|
115
|
+
if (action === 'disabled' || action === 'closed') {
|
|
117
116
|
// wait for analytics to be sent with the correct values
|
|
118
117
|
setTimeout(() => {
|
|
119
118
|
this.writeCommon('overlaySessionId', '');
|
|
120
119
|
this.writeCommon('topicId', '');
|
|
120
|
+
this.writeCommon('parentTopicId', '');
|
|
121
121
|
this.writeCommon('topicType', TopicType.UNSET);
|
|
122
122
|
this.writeCommon('category', Category.UNSET);
|
|
123
123
|
}, 200);
|
|
@@ -126,10 +126,6 @@ export class Analytics {
|
|
|
126
126
|
this.writeCommon('overlaySessionId', v4());
|
|
127
127
|
this.writeCommon('category', Category.EXPOSED_PAUSED_AD);
|
|
128
128
|
}
|
|
129
|
-
if (action === 'loaded' && payload.id) {
|
|
130
|
-
this.writeCommon('topicId', payload.id);
|
|
131
|
-
this.writeCommon('topicType', TopicType.UNSET);
|
|
132
|
-
}
|
|
133
129
|
}
|
|
134
130
|
if (event.slEventBus?.type === 'advertisement') {
|
|
135
131
|
if (action === 'opened') {
|
package/lib/heartbeat.js
CHANGED
|
@@ -5,7 +5,7 @@ import { logger } from './analytics';
|
|
|
5
5
|
export const heartbeat = ({ transport, $commonStore }) => {
|
|
6
6
|
let cancelFn = undefined;
|
|
7
7
|
const enabled = createSingleStore(false);
|
|
8
|
-
const
|
|
8
|
+
const revalidateInterval = 30000;
|
|
9
9
|
const { client, queryKey } = transport.createPromiseClient(AnalyticsService, {
|
|
10
10
|
method: 'send',
|
|
11
11
|
params: [enabled],
|
|
@@ -31,7 +31,7 @@ export const heartbeat = ({ transport, $commonStore }) => {
|
|
|
31
31
|
}
|
|
32
32
|
return Date.now();
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
revalidateInterval,
|
|
35
35
|
});
|
|
36
36
|
const mount = () => {
|
|
37
37
|
logger.debug('mounted heartbeat');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/sdk-web-analytics",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.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-api": "^1.
|
|
17
|
-
"@streamlayer/sdk-web-interfaces": "^1.
|
|
18
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
19
|
-
"@streamlayer/sdk-web-
|
|
20
|
-
"@streamlayer/sdk-web-
|
|
21
|
-
"@streamlayer/feature-gamification": "^1.
|
|
15
|
+
"@streamlayer/sl-eslib": "^5.228.0",
|
|
16
|
+
"@streamlayer/sdk-web-api": "^1.15.0",
|
|
17
|
+
"@streamlayer/sdk-web-interfaces": "^1.9.0",
|
|
18
|
+
"@streamlayer/sdk-web-logger": "^1.0.94",
|
|
19
|
+
"@streamlayer/sdk-web-core": "^1.19.0",
|
|
20
|
+
"@streamlayer/sdk-web-features": "^1.0.94",
|
|
21
|
+
"@streamlayer/feature-gamification": "^1.24.0"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|