@streamlayer/sdk-web-analytics 1.3.3 → 1.4.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 -12
- package/package.json +8 -8
package/lib/advertisement.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ type TransformedPayload = {
|
|
|
7
7
|
export declare class AdvertisementAnalytics {
|
|
8
8
|
private analytics;
|
|
9
9
|
constructor(analytics: Analytics);
|
|
10
|
-
received: ({
|
|
11
|
-
opened: ({
|
|
12
|
-
videoPlay: ({
|
|
13
|
-
buttonSelect: ({
|
|
14
|
-
bannerSelect: ({
|
|
10
|
+
received: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
11
|
+
opened: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
12
|
+
videoPlay: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
13
|
+
buttonSelect: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
14
|
+
bannerSelect: ({ id }: EventBusActionPayload["advertisement"], { topicSubType }: TransformedPayload) => void;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
package/lib/advertisement.js
CHANGED
|
@@ -16,9 +16,12 @@ export class AdvertisementAnalytics {
|
|
|
16
16
|
this.analytics = analytics;
|
|
17
17
|
this.analytics.onConnect(() => {
|
|
18
18
|
const listener = (event) => {
|
|
19
|
+
if (event.slEventBus?.skipAnalytics) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
19
22
|
if (event.slEventBus?.type === 'advertisement') {
|
|
20
|
-
const topicSubType = event.slEventBus.payload.
|
|
21
|
-
? MAP_PROMOTION_TYPE_TO_TOPIC_TYPE[event.slEventBus.payload.
|
|
23
|
+
const topicSubType = event.slEventBus.payload.type
|
|
24
|
+
? MAP_PROMOTION_TYPE_TO_TOPIC_TYPE[event.slEventBus.payload.type]
|
|
22
25
|
: TopicSubType.UNSET;
|
|
23
26
|
switch (event.slEventBus.action) {
|
|
24
27
|
case 'videoPlay':
|
|
@@ -42,57 +45,57 @@ export class AdvertisementAnalytics {
|
|
|
42
45
|
return eventBus.listen(listener);
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
|
-
received = ({
|
|
48
|
+
received = ({ id }, { topicSubType }) => {
|
|
46
49
|
this.analytics.write('games', {
|
|
47
50
|
common: {
|
|
48
51
|
...this.analytics.commonStore.getValues(),
|
|
49
52
|
kind: Kind.POLLS_RECEIVED,
|
|
50
|
-
topicId:
|
|
53
|
+
topicId: id,
|
|
51
54
|
topicType: TopicType.POLLS_PROMOTION,
|
|
52
55
|
topicSubType,
|
|
53
56
|
},
|
|
54
57
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
55
58
|
});
|
|
56
59
|
};
|
|
57
|
-
opened = ({
|
|
60
|
+
opened = ({ id }, { topicSubType }) => {
|
|
58
61
|
this.analytics.write('games', {
|
|
59
62
|
common: {
|
|
60
63
|
...this.analytics.commonStore.getValues(),
|
|
61
64
|
kind: Kind.POLLS_OPENED,
|
|
62
|
-
topicId:
|
|
65
|
+
topicId: id,
|
|
63
66
|
topicType: TopicType.POLLS_PROMOTION,
|
|
64
67
|
topicSubType,
|
|
65
68
|
},
|
|
66
69
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
67
70
|
});
|
|
68
71
|
};
|
|
69
|
-
videoPlay = ({
|
|
72
|
+
videoPlay = ({ id }, { topicSubType }) => {
|
|
70
73
|
this.analytics.write('games', {
|
|
71
74
|
common: {
|
|
72
75
|
...this.analytics.commonStore.getValues(),
|
|
73
|
-
topicId:
|
|
76
|
+
topicId: id,
|
|
74
77
|
kind: Kind.AD_VIDEO_PLAYED,
|
|
75
78
|
topicSubType,
|
|
76
79
|
},
|
|
77
80
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
78
81
|
});
|
|
79
82
|
};
|
|
80
|
-
buttonSelect = ({
|
|
83
|
+
buttonSelect = ({ id }, { topicSubType }) => {
|
|
81
84
|
this.analytics.write('games', {
|
|
82
85
|
common: {
|
|
83
86
|
...this.analytics.commonStore.getValues(),
|
|
84
|
-
topicId:
|
|
87
|
+
topicId: id,
|
|
85
88
|
kind: Kind.AD_BUTTON_NAVIGATED,
|
|
86
89
|
topicSubType,
|
|
87
90
|
},
|
|
88
91
|
pollOpenedFrom: PollOpenedFrom.UNSET,
|
|
89
92
|
});
|
|
90
93
|
};
|
|
91
|
-
bannerSelect = ({
|
|
94
|
+
bannerSelect = ({ id }, { topicSubType }) => {
|
|
92
95
|
this.analytics.write('games', {
|
|
93
96
|
common: {
|
|
94
97
|
...this.analytics.commonStore.getValues(),
|
|
95
|
-
topicId:
|
|
98
|
+
topicId: id,
|
|
96
99
|
kind: Kind.AD_BANNER_NAVIGATED,
|
|
97
100
|
topicSubType,
|
|
98
101
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/sdk-web-analytics",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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": "^1.10.0",
|
|
13
13
|
"@connectrpc/connect": "^1.5.0",
|
|
14
14
|
"nanoid": "3.3.7",
|
|
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-features": "^1.0.
|
|
20
|
-
"@streamlayer/sdk-web-core": "^1.
|
|
21
|
-
"@streamlayer/feature-gamification": "^1.
|
|
15
|
+
"@streamlayer/sl-eslib": "^5.130.0",
|
|
16
|
+
"@streamlayer/sdk-web-api": "^1.6.0",
|
|
17
|
+
"@streamlayer/sdk-web-interfaces": "^1.2.0",
|
|
18
|
+
"@streamlayer/sdk-web-logger": "^1.0.21",
|
|
19
|
+
"@streamlayer/sdk-web-features": "^1.0.21",
|
|
20
|
+
"@streamlayer/sdk-web-core": "^1.5.0",
|
|
21
|
+
"@streamlayer/feature-gamification": "^1.7.0"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|