DavidWells / analytics

Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors
https://getanalytics.io
MIT License
2.45k stars 244 forks source link

Support for new Amplitude Typescript SDK #311

Open elidupuis opened 2 years ago

elidupuis commented 2 years ago

Amplitude has deprecated their previous JavaScript SDK (which the existing plugin integrates). They now recommend using the new TypeScript Browser SDK.

How can we go about adding support for the newest SDK? Would something like customScriptSrc suffice for this or should the plugin be updated?

Note that Amplitude provides a migration guide for this transition. However, the new version isn't backwards compatible with amplitude-js.

DavidWells commented 2 years ago

To swap out to the new SDK you'd need to load the new SDK here in initialize https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-amplitude/src/browser.js#L38 and then remap all the page, track, identify calls (https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-amplitude/src/browser.js#L140-L155) if the SDK methods/inputs have changed.

We can publish the updates as a major version bump.

rmanalan commented 1 year ago

I've submitted #387 to address this issue. @DavidWells mind reviewing? Thanks in advance!

elidupuis commented 1 month ago

@DavidWells Any appetite revive this discussion and the attached PR?