Make componetName == extension (name)
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -15,15 +15,12 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { withAnalyticsContext } from '@backstage/core-plugin-api';
|
||||
import { Link } from '@backstage/core-components';
|
||||
|
||||
const ContextlessPlayground = () => {
|
||||
export const Playground = () => {
|
||||
return (
|
||||
<>
|
||||
<Link to="#clicked">Click Here</Link>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const Playground = withAnalyticsContext(ContextlessPlayground, {});
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ describe('GoogleAnalytics', () => {
|
||||
|
||||
describe('integration', () => {
|
||||
const context = {
|
||||
componentName: 'App',
|
||||
extension: 'App',
|
||||
pluginId: 'some-plugin',
|
||||
releaseNum: 1337,
|
||||
};
|
||||
@@ -125,7 +125,7 @@ describe('GoogleAnalytics', () => {
|
||||
expect(command).toBe('send');
|
||||
expect(data).toMatchObject({
|
||||
hitType: 'event',
|
||||
eventCategory: context.componentName,
|
||||
eventCategory: context.extension,
|
||||
eventAction: expectedAction,
|
||||
eventLabel: expectedLabel,
|
||||
eventValue: expectedValue,
|
||||
@@ -178,7 +178,7 @@ describe('GoogleAnalytics', () => {
|
||||
expect(command).toBe('send');
|
||||
expect(data).toMatchObject({
|
||||
hitType: 'event',
|
||||
eventCategory: context.componentName,
|
||||
eventCategory: context.extension,
|
||||
eventAction: expectedAction,
|
||||
eventLabel: expectedLabel,
|
||||
eventValue: expectedValue,
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ export class GoogleAnalytics implements AnalyticsApi {
|
||||
}: AnalyticsEvent) {
|
||||
const customMetadata = this.getCustomDimensionMetrics(context, attributes);
|
||||
|
||||
if (action === 'navigate' && context?.componentName === 'App') {
|
||||
if (action === 'navigate' && context?.extension === 'App') {
|
||||
// Set any/all custom dimensions.
|
||||
if (Object.keys(customMetadata).length) {
|
||||
ReactGA.set(customMetadata);
|
||||
@@ -117,7 +117,7 @@ export class GoogleAnalytics implements AnalyticsApi {
|
||||
}
|
||||
|
||||
ReactGA.event({
|
||||
category: context.componentName || 'App',
|
||||
category: context.extension || 'App',
|
||||
action,
|
||||
label: subject,
|
||||
value,
|
||||
|
||||
Reference in New Issue
Block a user