MCPcopy Index your code
hub / github.com/amplitude/Amplitude-TypeScript

github.com/amplitude/Amplitude-TypeScript @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,739 symbols 8,083 edges 855 files 245 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Amplitude-TypeScript

This is Amplitude's latest version of the JavaScript SDK, written in TypeScript.

Development

If you plan on contributing to this SDK, here's how you can start.

  1. Clone GitHub repo
  2. Install dependencies
  3. Build and link packages
$ git clone git@github.com:amplitude/Amplitude-TypeScript.git
$ nvm use
$ pnpm --version
$ pnpm install
$ pnpm build

Check our guidelines for repo contributions on CONTRIBUTING.md.

Projects

Testing Locally

To test the SDK locally, you can run our test server.

Before running the test server for the first time, copy ".env.example" as ".env" and replace the variables in '.env' with your own variables.

Run pnpm dev to run the test server. It will open up to the home page automatically in your default browser.

For more details visit the Test Server README.md

Troubleshooting

If you ever see an error that looks like this while running an Nx command (pnpm test, pnpm build, etc...):

Lerna (powered by Nx) DB transaction operation error: SqliteFailure(Error { code: SystemIoFailure, extended_code: 522 }, Some("disk I/O error"))

Run npx nx reset and try again

Documentation

See our Typescript SDK Reference for a list and description of all available SDK methods.

Extension points exported contracts — how you extend this code

BeforePlugin (Interface)
(no doc) [15 implementers]
packages/analytics-types/src/plugin.ts
IRequestWrapper (Interface)
(no doc) [7 implementers]
packages/analytics-core/src/network-request-event.ts
CampaignTracker (Interface)
(no doc) [13 implementers]
packages/analytics-react-native/src/campaign/types.ts
ElementSelectorLogger (Interface)
(no doc) [2 implementers]
packages/element-selector/src/types.ts
UnifiedClient (Interface)
(no doc) [2 implementers]
packages/unified/src/unified.ts
NativeSessionReplaySpec (Interface)
(no doc) [2 implementers]
packages/session-replay-react-native/src/native-module.ts
NetworkRequestEvent (Interface)
(no doc) [1 implementers]
packages/session-replay-browser/src/observers.ts
Options (Interface)
(no doc)
packages/plugin-web-attribution-browser/src/typings/web-attribution.ts

Core symbols most depended-on inside this repo

init
called by 586
packages/analytics-core/src/types/client/node-client.ts
setup
called by 349
packages/analytics-core/src/types/plugin.ts
push
called by 335
packages/analytics-core/src/timeline.ts
get
called by 192
packages/analytics-core/src/types/storage.ts
evaluate
called by 188
packages/plugin-autocapture-browser/src/pageActions/triggers.ts
track
called by 187
packages/analytics-core/src/types/client/core-client.ts
log
called by 186
packages/analytics-types/src/logger.ts
execute
called by 160
packages/analytics-core/src/types/plugin.ts

Shape

Method 1,068
Function 1,036
Interface 341
Class 273
Enum 21

Languages

TypeScript91%
Kotlin7%
Java2%
C++1%

Modules by API surface

examples/browser/chrome-ext/amplitude-min.js63 symbols
packages/analytics-core/src/network-request-event.ts44 symbols
packages/analytics-react-native/android/src/test/java/com/amplitude/reactnative/ConnectivityCheckerTest.kt37 symbols
packages/session-replay-browser/src/track-destination.ts33 symbols
packages/session-replay-browser/src/session-replay.ts31 symbols
packages/analytics-types/src/event.ts31 symbols
packages/analytics-core/src/diagnostics/diagnostics-storage.ts31 symbols
packages/analytics-core/src/identify.ts30 symbols
packages/analytics-react-native/src/react-native-client.ts28 symbols
packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt26 symbols
packages/analytics-core/src/revenue.ts26 symbols
packages/analytics-core/src/remote-config/remote-config.ts26 symbols

For agents

$ claude mcp add Amplitude-TypeScript \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact