Merge pull request #13309 from backstage/analytics/multiple-analytics

This commit is contained in:
Eric Peterson
2022-08-31 14:05:21 +02:00
committed by GitHub
5 changed files with 169 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
---
'@backstage/core-app-api': patch
---
If you'd like to send analytics events to multiple implementations, you may now
do so using the `MultipleAnalyticsApi` implementation provided by this package.
```tsx
import { MultipleAnalyticsApi } from '@backstage/core-app-api';
import {
analyticsApiRef,
configApiRef,
storageApiRef,
identityApiRef,
} from '@internal/backstage/core-plugin-api';
import { CustomAnalyticsApi } from '@internal/analytics';
import { VendorAnalyticsApi } from '@vendor/analytics';
createApiFactory({
api: analyticsApiRef,
deps: { configApi: configApiRef, identityApi: identityApiRef, storageApi: storageApiRef },
factory: ({ configApi, identityApi, storageApi }) =>
MultipleAnalyticsApi.fromApis([
VendorAnalyticsApi.fromConfig(configApi, { identityApi }),
CustomAnalyticsApi.fromConfig(configApi, { identityApi, storageApi }),
]),
}),
```