From 549d03ed8fd6b7be0e867b0797bf1c2032917837 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 31 Aug 2023 15:28:20 +0200 Subject: [PATCH] MOBILE-4362 analytics: Strip tags from event names --- src/core/services/analytics.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/services/analytics.ts b/src/core/services/analytics.ts index ae4e5ad29..e442a6a89 100644 --- a/src/core/services/analytics.ts +++ b/src/core/services/analytics.ts @@ -21,6 +21,7 @@ import { CoreSites } from './sites'; import { CoreConfig, CoreConfigProvider } from './config'; import { CoreConstants } from '../constants'; import { CoreUrlUtils } from './utils/url'; +import { CoreTextUtils } from '@services/utils/text'; /** * Helper service to support analytics. @@ -77,6 +78,11 @@ export class CoreAnalyticsService extends CoreDelegate { ...event, siteId: site.getId(), }; + + if (treatedEvent.type === CoreAnalyticsEventType.VIEW_ITEM || treatedEvent.type === CoreAnalyticsEventType.VIEW_ITEM_LIST) { + treatedEvent.name = CoreTextUtils.cleanTags(treatedEvent.name); + } + if ('url' in treatedEvent && treatedEvent.url) { if (!CoreUrlUtils.isAbsoluteURL(treatedEvent.url)) { treatedEvent.url = site.createSiteUrl(treatedEvent.url);