fix: analytics catagory locale

Signed-off-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Camila Belo
2024-01-30 11:30:33 +01:00
parent 915773bf0a
commit b5b9b8d98a
5 changed files with 17 additions and 8 deletions
@@ -585,7 +585,7 @@ describe('GoogleAnalytics', () => {
expect(data).toMatchObject({
hitType: 'event',
// expect to use the new default category
eventCategory: 'app',
eventCategory: 'App',
eventAction: 'click',
eventLabel: 'on something',
eventValue: 42,
@@ -167,10 +167,13 @@ export class GoogleAnalytics implements AnalyticsApi, NewAnalyticsApi {
const customMetadata = this.getCustomDimensionMetrics(context, attributes);
const extensionId = context.extensionId || context.extension;
const category = extensionId ? String(extensionId) : 'app';
const category = extensionId ? String(extensionId) : 'App';
// The legacy default extension was 'App' and the new one is 'app'
if (action === 'navigate' && category.toLocaleLowerCase() === 'app') {
if (
action === 'navigate' &&
category.toLocaleLowerCase('en-US').startsWith('app')
) {
this.capture.pageview(subject, customMetadata);
return;
}