@amplitude/sdk-adapter
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published


Amplitude Browser SDK Adapter Tool

Amplitude's tool to ease engineering cost of migrating SDK libraries. Currently supported only for the browser SDK. Segment's analytics SDK API can be kept and analytics actions will be forwarded to Amplitude. Currently support track and identify calls.

Usage

1. Install

npm install 

2. Import packages

import { AnalyticsAdapter } from "sdk-adapter";
import { AnalyticsBrowser } from "@segment/analytics-next";
import { createInstance } from "@amplitude/analytics-browser";

3. Create instances of Amplitude and Segment SDKs

const amplitude = createInstance();
amplitude.init(AMPLITUDE_API_KEY);

const segment = new AnalyticsBrowser();
segment.load({ writeKey: SEGMENT_WRITE_KEY });

4. Create adapter instance and replace Segment APIs with supported adapter APIs

const analytics = new AnalyticsAdapter(segment, amplitude);
analytics.track('test event')

Readme

Keywords

Package Sidebar

Install

npm i @amplitude/sdk-adapter

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

26.6 kB

Total Files

12

Last publish

Collaborators

  • kwallachamp
  • alec.amplitude
  • amplicynthia
  • mae.capozzi
  • sdk.dev
  • dnshi
  • kevinpagtakhan
  • justin-fiedler
  • qingzhuo
  • rctbusk
  • jackmccloy
  • amp_haoliu
  • myztiq
  • curtisbliu
  • jtran
  • kelvin-lu
  • nutwani
  • hao.yu
  • kelson.warner
  • ajhorst_amp
  • brian.giori