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:
+1
-1
@@ -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,
|
||||
|
||||
+5
-2
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -526,7 +526,7 @@ describe('GoogleAnalytics4', () => {
|
||||
expect(fnEvent).toHaveBeenCalledWith('page_view', {
|
||||
action: 'page_view',
|
||||
label: '/',
|
||||
category: 'app',
|
||||
category: 'App',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+5
-2
@@ -171,10 +171,13 @@ export class GoogleAnalytics4 implements AnalyticsApi, NewAnalyticsApi {
|
||||
}
|
||||
|
||||
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.event(
|
||||
{
|
||||
category,
|
||||
|
||||
+5
-2
@@ -129,10 +129,13 @@ export class NewRelicBrowser implements AnalyticsApi, NewAnalyicsApi {
|
||||
const { context, action, subject, value, attributes } = event;
|
||||
|
||||
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')
|
||||
) {
|
||||
const interaction = this.agent.interaction();
|
||||
interaction.setName(subject);
|
||||
if (value) {
|
||||
|
||||
Reference in New Issue
Block a user