Rename again to match module name

Signed-off-by: Jonathan Mezach <jonathan.mezach@rr-wfm.com>
This commit is contained in:
Jonathan Mezach
2023-07-12 11:30:17 +02:00
parent 7352d05fde
commit bc43820899
12 changed files with 33 additions and 4 deletions
@@ -107,7 +107,36 @@ export class NewRelicBrowser implements AnalyticsApi {
}
captureEvent(event: AnalyticsEvent) {
const { action, ...rest } = event;
this.agent.addPageAction(action, rest);
const { context, action, subject, value, attributes } = event;
if (action === 'navigate' && context.extension === 'App') {
const interaction = this.agent.interaction();
interaction.setName(subject);
Object.keys(context).forEach(key => {
if (context[key]) {
interaction.setAttribute(`context.${key}`, context[key]);
}
});
if (attributes) {
Object.keys(attributes).forEach(key => {
interaction.setAttribute(`attributes.${key}`, attributes[key]);
});
}
} else {
const customAttributes: {
[x: string]: string | number | boolean | undefined;
} = {};
Object.keys(context).forEach(key => {
if (context[key]) {
customAttributes[`context.${key}`] = context[key];
}
});
if (attributes) {
Object.keys(attributes).forEach(key => {
customAttributes[`attributes.${key}`] = attributes[key];
});
}
this.agent.addPageAction(action, customAttributes);
}
}
}
+2 -2
View File
@@ -4794,9 +4794,9 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-analytics-module-newrelic-browser@workspace:plugins/analytics-module-new-relic":
"@backstage/plugin-analytics-module-newrelic-browser@workspace:plugins/analytics-module-newrelic-browser":
version: 0.0.0-use.local
resolution: "@backstage/plugin-analytics-module-newrelic-browser@workspace:plugins/analytics-module-new-relic"
resolution: "@backstage/plugin-analytics-module-newrelic-browser@workspace:plugins/analytics-module-newrelic-browser"
dependencies:
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"