Twilio Segment logo

Backstage Twilio Segment Analytics Plugin

Created by Twilio Segment

Installation Instructions

These instructions apply to self-hosted Backstage only.

Install the plugin

Copy
yarn --cwd packages/app add @segment backstage-plugin-analytics-module-segment

Import it into your Backstage application

Copy
// packages/app/src/apis.ts
import {
  analyticsApiRef,
  configApiRef,
  identityApiRef,
} from '@backstage/core-plugin-api';
import { SegmentAnalytics } from '@segment/backstage-plugin-analytics-module-segment';

export const apis: AnyApiFactory[] = [
  // Instantiate and register the SegmentAnalytics API Implementation.
  createApiFactory({
    api: analyticsApiRef,
    deps: { configApi: configApiRef, identityApi: identityApiRef },
    factory: ({ configApi, identityApi }) =>
      SegmentAnalytics.fromConfig(configApi, {
        identityApi,
      }),
  }),
];

Optionally configure user anonymization (by default, this analytics plugin identifies the user taking actions as the logged in Backstage User’s entity reference string)

Copy
// packages/app/src/apis.ts
import {
  analyticsApiRef,
  configApiRef,
  identityApiRef,
} from '@backstage/core-plugin-api';
import { SegmentAnalytics } from '@segment/backstage-plugin-analytics-module-segment';

export const apis: AnyApiFactory[] = [
  // Instantiate and register the SegmentAnalytics API Implementation.
  createApiFactory({
    api: analyticsApiRef,
    deps: { configApi: configApiRef, identityApi: identityApiRef },
    factory: ({ configApi, identityApi }) =>
      SegmentAnalytics.fromConfig(configApi, {
        identityApi,
        userIdTransform: 'sha-256',
      }),
  }),
];

Configure the plugin

Copy
// app-config.yaml
app:
  analytics:
    segment:
      writeKey: abcABCfooBARtestKEY

Things to Know

Changelog

This changelog is produced from commits made to the Twilio Segment plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.

Breaking Changes

  • Target Backstage v1.35 which may require an upgrade if your app uses an older Backstage version #21 8 months ago

Features

  • Update to Backstage v1.35 following the upgrade helper. Exclude yarn 4 changes #21 8 months ago

Maintenance

  • Prepare package publishing and changelog generation #22 8 months ago

Set up Backstage in minutes with Roadie