From b51fc442ed12ca271fcfe87b06e1d0c9f8c59fb7 Mon Sep 17 00:00:00 2001 From: David Festal Date: Thu, 6 Jun 2024 12:52:58 +0200 Subject: [PATCH] Add `analytics` workspace Signed-off-by: David Festal --- workspaces/analytics/plugins-list.yaml | 3 ++ .../app-config.dynamic.yaml | 5 +++ .../analytics-module-ga/overlay/src/api.ts | 33 +++++++++++++++++++ .../analytics-module-ga/scalprum-config.json | 6 ++++ .../app-config.dynamic.yaml | 5 +++ .../analytics-module-ga4/overlay/src/api.ts | 33 +++++++++++++++++++ .../analytics-module-ga4/scalprum-config.json | 6 ++++ .../app-config.dynamic.yaml | 5 +++ .../overlay/src/api.ts | 33 +++++++++++++++++++ .../scalprum-config.json | 6 ++++ workspaces/analytics/ref | 1 + 11 files changed, 136 insertions(+) create mode 100644 workspaces/analytics/plugins-list.yaml create mode 100644 workspaces/analytics/plugins/analytics-module-ga/app-config.dynamic.yaml create mode 100644 workspaces/analytics/plugins/analytics-module-ga/overlay/src/api.ts create mode 100644 workspaces/analytics/plugins/analytics-module-ga/scalprum-config.json create mode 100644 workspaces/analytics/plugins/analytics-module-ga4/app-config.dynamic.yaml create mode 100644 workspaces/analytics/plugins/analytics-module-ga4/overlay/src/api.ts create mode 100644 workspaces/analytics/plugins/analytics-module-ga4/scalprum-config.json create mode 100644 workspaces/analytics/plugins/analytics-module-newrelic-browser/app-config.dynamic.yaml create mode 100644 workspaces/analytics/plugins/analytics-module-newrelic-browser/overlay/src/api.ts create mode 100644 workspaces/analytics/plugins/analytics-module-newrelic-browser/scalprum-config.json create mode 100644 workspaces/analytics/ref diff --git a/workspaces/analytics/plugins-list.yaml b/workspaces/analytics/plugins-list.yaml new file mode 100644 index 0000000..c771418 --- /dev/null +++ b/workspaces/analytics/plugins-list.yaml @@ -0,0 +1,3 @@ +plugins/analytics-module-ga: +plugins/analytics-module-ga4: +plugins/analytics-module-newrelic-browser: diff --git a/workspaces/analytics/plugins/analytics-module-ga/app-config.dynamic.yaml b/workspaces/analytics/plugins/analytics-module-ga/app-config.dynamic.yaml new file mode 100644 index 0000000..883b0fb --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga/app-config.dynamic.yaml @@ -0,0 +1,5 @@ +dynamicPlugins: + frontend: + backstage.plugin-analytics-module-ga: + apiFactories: + - importName: gaAnalyticsApi diff --git a/workspaces/analytics/plugins/analytics-module-ga/overlay/src/api.ts b/workspaces/analytics/plugins/analytics-module-ga/overlay/src/api.ts new file mode 100644 index 0000000..adbc102 --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga/overlay/src/api.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + AnyApiFactory, + analyticsApiRef, + configApiRef, + createApiFactory, + identityApiRef, +} from '@backstage/core-plugin-api'; +import { GoogleAnalytics } from './apis/implementations/AnalyticsApi'; + +export const gaAnalyticsApi: AnyApiFactory = createApiFactory({ + api: analyticsApiRef, + deps: { configApi: configApiRef, identityApi: identityApiRef }, + factory: ({ configApi, identityApi }) => + GoogleAnalytics.fromConfig(configApi, { + identityApi, + }), +}); diff --git a/workspaces/analytics/plugins/analytics-module-ga/scalprum-config.json b/workspaces/analytics/plugins/analytics-module-ga/scalprum-config.json new file mode 100644 index 0000000..bfd718a --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga/scalprum-config.json @@ -0,0 +1,6 @@ +{ + "name": "backstage.plugin-analytics-module-ga", + "exposedModules": { + "PluginRoot": "./src/api.ts" + } +} diff --git a/workspaces/analytics/plugins/analytics-module-ga4/app-config.dynamic.yaml b/workspaces/analytics/plugins/analytics-module-ga4/app-config.dynamic.yaml new file mode 100644 index 0000000..b24aa91 --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga4/app-config.dynamic.yaml @@ -0,0 +1,5 @@ +dynamicPlugins: + frontend: + backstage.plugin-analytics-module-ga4: + apiFactories: + - importName: ga4AnalyticsApi diff --git a/workspaces/analytics/plugins/analytics-module-ga4/overlay/src/api.ts b/workspaces/analytics/plugins/analytics-module-ga4/overlay/src/api.ts new file mode 100644 index 0000000..f45f37f --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga4/overlay/src/api.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + AnyApiFactory, + analyticsApiRef, + configApiRef, + createApiFactory, + identityApiRef, +} from '@backstage/core-plugin-api'; +import { GoogleAnalytics4 } from './apis/implementations/AnalyticsApi'; + +export const ga4AnalyticsApi: AnyApiFactory = createApiFactory({ + api: analyticsApiRef, + deps: { configApi: configApiRef, identityApi: identityApiRef }, + factory: ({ configApi, identityApi }) => + GoogleAnalytics4.fromConfig(configApi, { + identityApi, + }), +}); diff --git a/workspaces/analytics/plugins/analytics-module-ga4/scalprum-config.json b/workspaces/analytics/plugins/analytics-module-ga4/scalprum-config.json new file mode 100644 index 0000000..4715fb6 --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-ga4/scalprum-config.json @@ -0,0 +1,6 @@ +{ + "name": "backstage.plugin-analytics-module-ga4", + "exposedModules": { + "PluginRoot": "./src/api.ts" + } +} diff --git a/workspaces/analytics/plugins/analytics-module-newrelic-browser/app-config.dynamic.yaml b/workspaces/analytics/plugins/analytics-module-newrelic-browser/app-config.dynamic.yaml new file mode 100644 index 0000000..1294ad5 --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-newrelic-browser/app-config.dynamic.yaml @@ -0,0 +1,5 @@ +dynamicPlugins: + frontend: + backstage.plugin-analytics-module-newrelic-browser: + apiFactories: + - importName: newRelicBrowserAnalyticsApi diff --git a/workspaces/analytics/plugins/analytics-module-newrelic-browser/overlay/src/api.ts b/workspaces/analytics/plugins/analytics-module-newrelic-browser/overlay/src/api.ts new file mode 100644 index 0000000..0fa234b --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-newrelic-browser/overlay/src/api.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + AnyApiFactory, + analyticsApiRef, + configApiRef, + createApiFactory, + identityApiRef, +} from '@backstage/core-plugin-api'; +import { NewRelicBrowser } from './apis/implementations/AnalyticsApi'; + +export const newRelicBrowserAnalyticsApi: AnyApiFactory = createApiFactory({ + api: analyticsApiRef, + deps: { configApi: configApiRef, identityApi: identityApiRef }, + factory: ({ configApi, identityApi }) => + NewRelicBrowser.fromConfig(configApi, { + identityApi, + }), +}); diff --git a/workspaces/analytics/plugins/analytics-module-newrelic-browser/scalprum-config.json b/workspaces/analytics/plugins/analytics-module-newrelic-browser/scalprum-config.json new file mode 100644 index 0000000..dc7d496 --- /dev/null +++ b/workspaces/analytics/plugins/analytics-module-newrelic-browser/scalprum-config.json @@ -0,0 +1,6 @@ +{ + "name": "backstage.plugin-analytics-module-newrelic-browser", + "exposedModules": { + "PluginRoot": "./src/api.ts" + } +} diff --git a/workspaces/analytics/ref b/workspaces/analytics/ref new file mode 100644 index 0000000..9481020 --- /dev/null +++ b/workspaces/analytics/ref @@ -0,0 +1 @@ +b6a829284e0f4e10e6f7d9036cab71e2068a8829 \ No newline at end of file