@streamscloud/streams-analytics-collector 2.0.5 → 2.0.7
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.
|
@@ -139,6 +139,48 @@ export declare class AppEventsTracker {
|
|
|
139
139
|
* @param adId - The unique ad ID for this element
|
|
140
140
|
*/
|
|
141
141
|
static trackAdImpressionWithVisibility(el: HTMLElement, adId: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Track when a short video is shown to the user (basic, immediate call)
|
|
144
|
+
* @param videoId - The ID of the short video
|
|
145
|
+
*/
|
|
146
|
+
static trackShortVideoImpression(videoId: string): void;
|
|
147
|
+
/**
|
|
148
|
+
* Track when a short video is shown to the user, using viewport visibility tracking.
|
|
149
|
+
* The impression event will only be fired if the element becomes visible (at least 50% in viewport).
|
|
150
|
+
* The event is only fired once per videoId per session/visit.
|
|
151
|
+
*
|
|
152
|
+
* @param el - The DOM element to observe (e.g., the video element)
|
|
153
|
+
* @param videoId - The unique video ID for this element
|
|
154
|
+
*/
|
|
155
|
+
static trackShortVideoImpressionWithVisibility(el: HTMLElement, videoId: string): void;
|
|
156
|
+
/**
|
|
157
|
+
* Track when a short video is viewed by the user
|
|
158
|
+
* @param videoId - The ID of the short video
|
|
159
|
+
* @param playedPercents - The percentage of the video that was played (optional)
|
|
160
|
+
*/
|
|
161
|
+
static trackShortVideoView(videoId: string): void;
|
|
162
|
+
/**
|
|
163
|
+
* Track when a product in a short video is clicked
|
|
164
|
+
* @param productId - The ID of the product
|
|
165
|
+
* @param videoId - The ID of the short video containing the product
|
|
166
|
+
*/
|
|
167
|
+
static trackShortVideoProductClick(productId: string, videoId: string): void;
|
|
168
|
+
/**
|
|
169
|
+
* Track when a product in a short video is shown to the user (basic, immediate call)
|
|
170
|
+
* @param productId - The ID of the product
|
|
171
|
+
* @param videoId - The ID of the short video containing the product
|
|
172
|
+
*/
|
|
173
|
+
static trackShortVideoProductImpression(productId: string, videoId: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Track when a product in a short video is shown to the user, using viewport visibility tracking.
|
|
176
|
+
* The impression event will only be fired if the element becomes visible (at least 50% in viewport).
|
|
177
|
+
* The event is only fired once per productId per session/visit.
|
|
178
|
+
*
|
|
179
|
+
* @param el - The DOM element to observe (e.g., the product element)
|
|
180
|
+
* @param productId - The unique product ID for this element
|
|
181
|
+
* @param videoId - The ID of the short video containing the product
|
|
182
|
+
*/
|
|
183
|
+
static trackShortVideoProductImpressionWithVisibility(el: HTMLElement, productId: string, videoId: string): void;
|
|
142
184
|
/**
|
|
143
185
|
* Report an app event to the API
|
|
144
186
|
* @private
|
|
@@ -234,6 +234,70 @@ class AppEventsTracker {
|
|
|
234
234
|
});
|
|
235
235
|
// The ViewportVisibilityTracker will call the callback when visible
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Track when a short video is shown to the user (basic, immediate call)
|
|
239
|
+
* @param videoId - The ID of the short video
|
|
240
|
+
*/
|
|
241
|
+
static trackShortVideoImpression(videoId) {
|
|
242
|
+
this.reportAppEvent(videoId, AppEventType.ShortVideoImpression);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Track when a short video is shown to the user, using viewport visibility tracking.
|
|
246
|
+
* The impression event will only be fired if the element becomes visible (at least 50% in viewport).
|
|
247
|
+
* The event is only fired once per videoId per session/visit.
|
|
248
|
+
*
|
|
249
|
+
* @param el - The DOM element to observe (e.g., the video element)
|
|
250
|
+
* @param videoId - The unique video ID for this element
|
|
251
|
+
*/
|
|
252
|
+
static trackShortVideoImpressionWithVisibility(el, videoId) {
|
|
253
|
+
if (!el || !videoId)
|
|
254
|
+
return;
|
|
255
|
+
ViewportVisibilityTracker.registerTile(el, videoId, (vid) => {
|
|
256
|
+
this.reportAppEvent(vid, AppEventType.ShortVideoImpression);
|
|
257
|
+
});
|
|
258
|
+
// The ViewportVisibilityTracker will call the callback when visible
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Track when a short video is viewed by the user
|
|
262
|
+
* @param videoId - The ID of the short video
|
|
263
|
+
* @param playedPercents - The percentage of the video that was played (optional)
|
|
264
|
+
*/
|
|
265
|
+
static trackShortVideoView(videoId) {
|
|
266
|
+
this.reportAppEvent(videoId, AppEventType.ShortVideoView);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Track when a product in a short video is clicked
|
|
270
|
+
* @param productId - The ID of the product
|
|
271
|
+
* @param videoId - The ID of the short video containing the product
|
|
272
|
+
*/
|
|
273
|
+
static trackShortVideoProductClick(productId, videoId) {
|
|
274
|
+
this.reportAppEvent(productId, AppEventType.ShortVideoProductClick, videoId);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Track when a product in a short video is shown to the user (basic, immediate call)
|
|
278
|
+
* @param productId - The ID of the product
|
|
279
|
+
* @param videoId - The ID of the short video containing the product
|
|
280
|
+
*/
|
|
281
|
+
static trackShortVideoProductImpression(productId, videoId) {
|
|
282
|
+
this.reportAppEvent(productId, AppEventType.ShortVideoProductImpression, videoId);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Track when a product in a short video is shown to the user, using viewport visibility tracking.
|
|
286
|
+
* The impression event will only be fired if the element becomes visible (at least 50% in viewport).
|
|
287
|
+
* The event is only fired once per productId per session/visit.
|
|
288
|
+
*
|
|
289
|
+
* @param el - The DOM element to observe (e.g., the product element)
|
|
290
|
+
* @param productId - The unique product ID for this element
|
|
291
|
+
* @param videoId - The ID of the short video containing the product
|
|
292
|
+
*/
|
|
293
|
+
static trackShortVideoProductImpressionWithVisibility(el, productId, videoId) {
|
|
294
|
+
if (!el || !productId || !videoId)
|
|
295
|
+
return;
|
|
296
|
+
ViewportVisibilityTracker.registerTile(el, productId, (pid) => {
|
|
297
|
+
this.reportAppEvent(pid, AppEventType.ShortVideoProductImpression, videoId);
|
|
298
|
+
});
|
|
299
|
+
// The ViewportVisibilityTracker will call the callback when visible
|
|
300
|
+
}
|
|
237
301
|
/**
|
|
238
302
|
* Report an app event to the API
|
|
239
303
|
* @private
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
export declare enum AppEventType {
|
|
2
|
+
AdClick = "AD_CLICK",
|
|
3
|
+
AdImpression = "AD_IMPRESSION",
|
|
4
|
+
CommunityMessageView = "COMMUNITY_MESSAGE_VIEW",
|
|
5
|
+
ContributionCreated = "CONTRIBUTION_CREATED",
|
|
2
6
|
PostView = "POST_VIEW",
|
|
7
|
+
ShortVideoImpression = "SHORT_VIDEO_IMPRESSION",
|
|
8
|
+
ShortVideoProductClick = "SHORT_VIDEO_PRODUCT_CLICK",
|
|
9
|
+
ShortVideoProductImpression = "SHORT_VIDEO_PRODUCT_IMPRESSION",
|
|
3
10
|
ShortVideoView = "SHORT_VIDEO_VIEW",
|
|
4
|
-
CommunityMessageView = "COMMUNITY_MESSAGE_VIEW",
|
|
5
|
-
StreamTileImpression = "STREAM_TILE_IMPRESSION",
|
|
6
|
-
StreamTileClick = "STREAM_TILE_CLICK",
|
|
7
|
-
StreamView = "STREAM_VIEW",
|
|
8
11
|
StreamEngagementTime = "STREAM_ENGAGEMENT_TIME",
|
|
9
|
-
StreamScrollDepth = "STREAM_SCROLL_DEPTH",
|
|
10
12
|
StreamPageView = "STREAM_PAGE_VIEW",
|
|
11
13
|
StreamProductClick = "STREAM_PRODUCT_CLICK",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
StreamProductImpression = "STREAM_PRODUCT_IMPRESSION",
|
|
15
|
+
StreamScrollDepth = "STREAM_SCROLL_DEPTH",
|
|
16
|
+
StreamTileClick = "STREAM_TILE_CLICK",
|
|
17
|
+
StreamTileImpression = "STREAM_TILE_IMPRESSION",
|
|
18
|
+
StreamView = "STREAM_VIEW"
|
|
14
19
|
}
|
|
15
20
|
export declare enum CommunityMessageStatus {
|
|
16
21
|
Sent = "SENT",
|
package/dist/analytics/types.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
var AppEventType;
|
|
2
2
|
(function (AppEventType) {
|
|
3
|
+
AppEventType["AdClick"] = "AD_CLICK";
|
|
4
|
+
AppEventType["AdImpression"] = "AD_IMPRESSION";
|
|
5
|
+
AppEventType["CommunityMessageView"] = "COMMUNITY_MESSAGE_VIEW";
|
|
6
|
+
AppEventType["ContributionCreated"] = "CONTRIBUTION_CREATED";
|
|
3
7
|
AppEventType["PostView"] = "POST_VIEW";
|
|
8
|
+
AppEventType["ShortVideoImpression"] = "SHORT_VIDEO_IMPRESSION";
|
|
9
|
+
AppEventType["ShortVideoProductClick"] = "SHORT_VIDEO_PRODUCT_CLICK";
|
|
10
|
+
AppEventType["ShortVideoProductImpression"] = "SHORT_VIDEO_PRODUCT_IMPRESSION";
|
|
4
11
|
AppEventType["ShortVideoView"] = "SHORT_VIDEO_VIEW";
|
|
5
|
-
AppEventType["CommunityMessageView"] = "COMMUNITY_MESSAGE_VIEW";
|
|
6
|
-
AppEventType["StreamTileImpression"] = "STREAM_TILE_IMPRESSION";
|
|
7
|
-
AppEventType["StreamTileClick"] = "STREAM_TILE_CLICK";
|
|
8
|
-
AppEventType["StreamView"] = "STREAM_VIEW";
|
|
9
12
|
AppEventType["StreamEngagementTime"] = "STREAM_ENGAGEMENT_TIME";
|
|
10
|
-
AppEventType["StreamScrollDepth"] = "STREAM_SCROLL_DEPTH";
|
|
11
13
|
AppEventType["StreamPageView"] = "STREAM_PAGE_VIEW";
|
|
12
14
|
AppEventType["StreamProductClick"] = "STREAM_PRODUCT_CLICK";
|
|
13
|
-
AppEventType["
|
|
14
|
-
AppEventType["
|
|
15
|
+
AppEventType["StreamProductImpression"] = "STREAM_PRODUCT_IMPRESSION";
|
|
16
|
+
AppEventType["StreamScrollDepth"] = "STREAM_SCROLL_DEPTH";
|
|
17
|
+
AppEventType["StreamTileClick"] = "STREAM_TILE_CLICK";
|
|
18
|
+
AppEventType["StreamTileImpression"] = "STREAM_TILE_IMPRESSION";
|
|
19
|
+
AppEventType["StreamView"] = "STREAM_VIEW";
|
|
15
20
|
})(AppEventType || (AppEventType = {}));
|
|
16
21
|
var CommunityMessageStatus;
|
|
17
22
|
(function (CommunityMessageStatus) {
|