diff --git a/content/assets/logos/twilio-segment/twilio-segment.png b/content/assets/logos/twilio-segment/twilio-segment.png new file mode 100644 index 000000000..5bd4922d3 Binary files /dev/null and b/content/assets/logos/twilio-segment/twilio-segment.png differ diff --git a/content/backstage/plugins/twilio-segment-analytics.md b/content/backstage/plugins/twilio-segment-analytics.md new file mode 100644 index 000000000..9f53486f7 --- /dev/null +++ b/content/backstage/plugins/twilio-segment-analytics.md @@ -0,0 +1,88 @@ +--- +humanName: Twilio Segment +heading: 'Backstage Twilio Segment Analytics Plugin' +lead: 'An opinionated implementation of the Backstage Analytics API for Segment, from the folks at Segment.' +attribution: + text: Twilio Segment + href: https://segment.com + +seo: + title: 'Backstage Twilio Segment Analytics Plugin | Roadie' + description: | + An opinionated implementation of the Backstage Analytics API for Segment, from the folks at Segment. + +logoImage: '../../assets/logos/twilio-segment/twilio-segment.png' + +gettingStarted: + - intro: Install the plugin + language: bash + code: yarn --cwd packages/app add @segment backstage-plugin-analytics-module-segment + + - intro: Import it into your Backstage application + language: typescript + code: | + // 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, + }), + }), + ]; + + - intro: Optionally configure user anonymization (by default, this analytics plugin identifies the user taking actions as the logged in Backstage User's entity reference string) + language: typescript + code: | + // 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', + }), + }), + ]; + + - intro: Configure the plugin + language: yaml + code: | + // app-config.yaml + app: + analytics: + segment: + writeKey: abcABCfooBARtestKEY +--- + +### Things to know + +- This plugin requires an active workspace with [Segment](https://segment.com/). +- This plugin uses [Analytics.js Source](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/). +- You'll need a [Segment Write Key](https://segment.com/docs/connections/find-writekey/) to use this plugin. +- + +### Useful links + +- [npm]() +- [GitHub](https://github.com/segmentio/segment-backstage-plugins/tree/main/plugins/analytics-module-segment)