Count page views once per load and skip known bots.

Stop auto-counting list APIs and homepage sliders, track static pages via pageKey, and add store-specials AI list matching.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-16 17:33:44 +03:30
co-authored by Cursor
parent 6517877bed
commit b7ca306097
23 changed files with 688 additions and 85 deletions
+14 -5
View File
@@ -4,6 +4,7 @@ import {
Controller,
Delete,
Get,
Headers,
Param,
Patch,
Post,
@@ -173,20 +174,25 @@ export class PublicStoreItemsController {
) {}
@Get()
async list(@Param('host') host: string, @Query() query: ListPublicStoreItemsDto) {
const result = await this.service.listPublic(host, query);
this.analytics.trackPublicPage(host, 'store_item_list');
return result;
list(@Param('host') host: string, @Query() query: ListPublicStoreItemsDto) {
return this.service.listPublic(host, query);
}
@Get('by-product/:productId')
async getByProduct(
@Param('host') host: string,
@Param('productId') productId: string,
@Headers('user-agent') userAgent?: string,
) {
const result = await this.service.getPublicByProduct(host, productId);
if (result.storeItem) {
this.analytics.trackPublicPage(host, 'store_item_detail', result.storeItem.id);
this.analytics.trackPublicPage(
host,
'store_item_detail',
result.storeItem.id,
undefined,
userAgent,
);
}
return result;
}
@@ -195,12 +201,15 @@ export class PublicStoreItemsController {
async getVariant(
@Param('host') host: string,
@Param('variantId') variantId: string,
@Headers('user-agent') userAgent?: string,
) {
const result = await this.service.getPublicVariant(host, variantId);
this.analytics.trackPublicPage(
host,
'store_item_detail',
result.variant.storeItemId,
undefined,
userAgent,
);
return result;
}