More standard installation method/instructions.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-09-16 22:32:10 +02:00
parent 0bf2112f9d
commit b9e3a03f9c
4 changed files with 37 additions and 19 deletions
+17 -5
View File
@@ -4,16 +4,28 @@ This plugin provides an opinionated implementation of the Backstage Analytics
API for Google Analytics. Once installed and configured, analytics events will
be sent to GA as your users navigate and use your Backstage instance.
This plugin contains no (and will never contain any) other functionality.
This plugin contains no other functionality.
## Installation
1. Install this plugin in your Backstage app:
`cd packages/app && yarn add @backstage/plugin-analytics-module-ga`
2. Register the plugin with your App. In most instances of Backstage, this is
as simple as adding `export { analyticsModuleGA } from '@backstage/plugin-analytics-module-ga';`
to your `packages/app/src/plugins.ts` file.
3. Configure the plugin (see below).
2. Add the API implementation to your App and configure the plugin (see below).
```tsx
// packages/app/src/apis.ts
import { analyticsApiRef, configApiRef } from '@backstage/core-plugin-api';
import { GoogleAnalytics } from '@backstage/plugin-analytics-module-ga';
export const apis: AnyApiFactory[] = [
// Instantiate and register the GA Analytics API Implementation.
createApiFactory({
api: analyticsApiRef,
deps: { configApi: configApiRef },
factory: ({ configApi }) => GoogleAnalytics.fromConfig(configApi),
}),
];
```
## Configuration