Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@janus-idp/backstage-plugin-analytics-provider-segment

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@janus-idp/backstage-plugin-analytics-provider-segment

This plugin provides an implementation of the Backstage Analytics API for Segment. Once installed and configured, analytics events will be sent to Segment as your users navigate and use your Backstage instance.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
decreased by-34.48%
Maintainers
1
Weekly downloads
 
Created
Source

Analytics Module: Segment

This plugin provides an implementation of the Backstage Analytics API for Segment. Once installed and configured, analytics events will be sent to Segment as your users navigate and use your Backstage instance.

This plugin contains no other functionality.

Installation

  1. Install the plugin package in your Backstage app: cd packages/app && yarn add @janus-idp/backstage-plugin-analytics-provider-segment"
  2. Wire up the API implementation to your App:
// packages/app/src/apis.ts
import { analyticsApiRef, configApiRef } from '@backstage/core-plugin-api';
import { SegmentAnalytics } from '@janus-idp/plugin-analytics-module-segment';

export const apis: AnyApiFactory[] = [
  // Instantiate and register the GA Analytics API Implementation.
  createApiFactory({
    api: analyticsApiRef,
    deps: { configApi: configApiRef, identityApi: identityApiRef },
    factory: ({ configApi, identitApi }) =>
      SegmentAnalytics.fromConfig(configApi, identitApi),
  }),
];
  1. Configure the plugin in your app-config.yaml:

The following is the minimum configuration required to start sending analytics events to Segment. All that's needed is your Segment Write Key

# app-config.yaml
app:
  analytics:
    segment:
      writeKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      maskIP: true # prevents IP adresses to be sent if true

Debugging and Testing

In pre-production environments, you may wish to set additional configurations to turn off reporting to Analytics. You can do so like this:

app:
  analytics:
    segment:
      testMode: true # Prevents data being sent to Segment

You might commonly set the above in an app-config.local.yaml file, which is normally gitignore'd but loaded and merged in when Backstage is bootstrapped.

Development

If you would like to contribute improvements to this plugin, the easiest way to make and test changes is to do the following:

  1. Clone the main Backstage monorepo git clone git@github.com:janus-idp/backstage-plugins.git
  2. Install all dependencies yarn install
  3. If one does not exist, create an app-config.local.yaml file in the root of the monorepo and add config for this plugin (see below)
  4. Enter this plugin's working directory: cd plugins/analytics-provider-segment
  5. Start the plugin in isolation: yarn start
  6. Navigate to the playground page at http://localhost:3000/segment
  7. Open the web console to see events fire when you navigate or when you interact with instrumented components.

Code for the isolated version of the plugin can be found inside the /dev directory. Changes to the plugin are hot-reloaded.

FAQs

Package last updated on 15 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc