Skip to content

amplitude/sdk-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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')

Releases

No releases published

Packages

No packages published