由 Noor 出售

Full-featured TypeScript SDK monorepo for Amplitude analytics, session replay, and experiment across Browser, Node.js, and React Native. Includes a rich plugin ecosystem for autocapture, web attribution, page views, and more.
This block provides the full Amplitude TypeScript SDK monorepo packages for browser, Node.js, and React Native analytics. It covers event tracking, user identification, session management, revenue logging, and plugin architecture. Typical buyers are backend/fullstack engineers embedding Amplitude analytics into web apps or Node.js services.
analytics-browser/ - Browser SDK: init, track, identify, revenue, session, pluginsanalytics-browser-test/ - Integration tests for the browser SDKanalytics-client-common/ - Shared attribution, storage, transport, cookie utilitiesanalytics-core/ - Core SDK primitives: config, logger, plugins, transports, storageanalytics-node/ - Node.js SDK implementationanalytics-node-test/ - Integration tests for the Node SDKanalytics-react-native/ - React Native SDK implementationanalytics-types/ - Shared TypeScript type definitionse2e-remote-config/ - End-to-end remote configuration testsgtm-snippet/ - Google Tag Manager snippet generationplugin-autocapture-browser/ - Auto-capture plugin for browser interactionsplugin-custom-enrichment-browser/ - Custom event enrichment pluginplugin-event-property-attribution-browser/ - Event-level attribution propertiesplugin-experiment-browser/ - Amplitude Experiment integration pluginplugin-global-user-properties/ - Plugin for setting global user propertiesplugin-network-capture-browser/ - Network request capture pluginplugin-page-url-enrichment-browser/ - Page URL enrichment pluginplugin-page-view-tracking-browser/ - Automatic page view trackingplugin-session-replay-browser/ - Session replay plugin for browserplugin-session-replay-react-native/ - Session replay plugin for React Nativeplugin-stub-browser/ - Stub plugin for testingplugin-web-attribution-browser/ - Web attribution tracking pluginplugin-web-vitals-browser/ - Core Web Vitals tracking plugin启动隔离沙箱并在服务器端直接运行 — 无需本地配置。
此版本的 Tetrees AI Review
This TypeScript cli / script completed archive review with strong static results. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
管道 avcp-2026-08-04.1 · SHA-256 9c3bf0560f237c8b…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
审查日期 2026年8月4日
将此产品直接导入你的 AI IDE、网页构建器或云端 IDE。
将 Tetrees 连接到兼容的 AI IDE,列出你拥有的产品并获取已验证 ZIP,同时不会开放卖家上传权限。
暂无评价。
Sign in to join the discussion
Loading discussion…
segment-session-replay-plugin/segment-session-replay-plugin-react-native/ - Segment + session replay for RNsession-replay-browser/ - Session replay core for browsersession-replay-react-native/ - Session replay core for React Nativetargeting/ - Targeting and audience utilitiesunified/ - Unified SDK entry pointnpm install @amplitude/analytics-browser tslib
# For Node.js usage:
npm install @amplitude/analytics-node tslib
# For React Native:
npm install @amplitude/analytics-react-native tslib
# Peer dependencies for browser (React playground):
npm install react react-dom
No native build steps are required for browser or Node.js. For React Native, run npx pod-install after install on iOS and ensure Android linking is complete via npx expo prebuild if using Expo.
source/ directory into your project root (e.g., ./source/).tsconfig.json if you want to import from source directly:
{
"compilerOptions": {
"paths": {
"@amplitude/analytics-browser": ["./source/analytics-browser/src/index.ts"],
"@amplitude/analytics-core": ["./source/analytics-core/src/index.ts"],
"@amplitude/analytics-client-common": ["./source/analytics-client-common/src/index.ts"]
}
}
}
AMPLITUDE_API_KEY=your_api_key_here
tslib is available (it is listed as a direct dependency in each package).node >= 14 is used. The browser SDK targets ES5/ESM via separate tsconfig files (tsconfig.es5.json, tsconfig.esm.json).init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>
Initializes the Amplitude SDK with your API key. Must be called before any other method. Pass userId to associate events with a known user from the start. options accepts config for server zone, cookie storage, transport, and more.
track(
eventInput: string | BaseEvent,
eventProperties?: Record<string, any>,
eventOptions?: EventOptions
): AmplitudeReturn<Result>
Sends an analytics event. Pass a string event name or a full BaseEvent object. eventProperties is a flat key/value map attached to the event. Returns a promise-like AmplitudeReturn that resolves when the event is flushed.
identify(identify: Identify, eventOptions?: EventOptions): AmplitudeReturn<Result>
Sends an identify call to set or update user properties. Build the Identify object using its chainable methods (set, setOnce, add, append, etc.) before passing it. Used whenever user profile data changes.
class Revenue {
setProductId(productId: string): Revenue
setPrice(price: number): Revenue
setQuantity(quantity: number): Revenue
setRevenue(revenue: number): Revenue
setEventProperties(properties: Record<string, any>): Revenue
}
Builder class for revenue events. Construct with new Revenue(), chain setters, then pass to revenue(). Used to log in-app purchases or subscription events accurately.
createInstance(): AmplitudeBrowser
Creates an isolated AmplitudeBrowser instance with its own config and event queue. Use when running multiple Amplitude projects in the same browser context (e.g., multi-tenant apps).
parseLegacyCookies(
apiKey: string,
cookieStorage: Storage<UserSession>,
deleteLegacyCookies?: boolean
): Promise<UserSession>
Reads and parses Amplitude v1 legacy cookies, returning a UserSession object. Use during SDK migration from v1 to v2 to preserve existing device/user/session IDs.
Initialize the SDK and track a custom event with properties in a TypeScript browser application.
import { init, track, flush } from './source/analytics-browser/src/index';
const API_KEY = process.env.AMPLITUDE_API_KEY ?? '';
// Initialize once at app startup
init(API_KEY, undefined, {
defaultTracking: true,
});
// Track a custom event
track('Button Clicked', {
button_name: 'sign_up',
page: '/home',
});
// Flush pending events before page unload
window.addEventListener('beforeunload', () => {
flush();
});
Identify a logged-in user and set user properties after authentication.
import { init, identify, setUserId } from './source/analytics-browser/src/index';
import { Identify } from './source/analytics-core/src/index';
init(process.env.AMPLITUDE_API_KEY ?? '');
function onUserLogin(userId: string, plan: string, age: number) {
setUserId(userId);
const identifyEvent = new Identify();
identifyEvent.set('plan', plan);
identifyEvent.set('age', age);
identifyEvent.setOnce('initial_plan', plan);
identifyEvent.add('login_count', 1);
identify(identifyEvent);
}
onUserLogin('user-123', 'pro', 28);
Log a purchase event using the Revenue builder.
import { init, revenue } from './source/analytics-browser/src/index';
import { Revenue } from './source/analytics-core/src/index';
init(process.env.AMPLITUDE_API_KEY ?? '');
function logPurchase(productId: string, price: number, quantity: number) {
const revenueEvent = new Revenue()
.setProductId(productId)
.setPrice(price)
.setQuantity(quantity)
.setRevenue(price * quantity)
.setEventProperties({ category: 'subscription' });
revenue(revenueEvent);
}
logPurchase('pro-monthly', 9.99, 1);
Use createInstance when you need two independent Amplitude projects in the same page.
import { createInstance } from './source/analytics-browser/src/index';
const analyticsA = createInstance();
const analyticsB = createInstance();
analyticsA.init('API_KEY_PROJECT_A');
analyticsB.init('API_KEY_PROJECT_B');
analyticsA.track('Page Viewed', { project: 'A' });
analyticsB.track('Page Viewed', { project: 'B' });
analytics-browser/src/index.ts - Public entry point; re-exports all browser SDK methods from the default client singleton and named exports.analytics-browser/src/browser-client.ts - AmplitudeBrowser class implementation with full lifecycle management.analytics-browser/src/browser-client-factory.ts - Instantiates the default singleton client and exports createInstance.analytics-browser/src/config.ts - Browser-specific config defaults and merging logic.analytics-browser/src/cookie-migration/index.ts - Parses Amplitude v1 legacy cookies for SDK migration.analytics-browser/src/attribution/ - UTM, referrer, and campaign attribution parsing and tracking.analytics-browser/src/plugins/ - Built-in browser plugins (destination, identity sender, etc.).analytics-browser/src/storage/ - Cookie and localStorage adapters.analytics-browser/src/transports/ - HTTP fetch transport implementation.analytics-browser/src/video-capture/ - Video interaction capture utilities.analytics-browser/src/utils/ - Snippet helpers, misc utilities.analytics-browser/generated/ - Pre-built snippet files for CDN/GTM deployment.analytics-client-common/src/index.ts - Shared utilities: campaign parsing, cookie naming, session detection, storage helpers, analytics connector.analytics-core/src/index.ts - Core primitives: AmplitudeCore, Identify, Revenue, Config, Logger, MemoryStorage, CookieStorage, transport base classes, remote config client.analytics-node/ - Node.js SDK; mirrors browser SDK but uses Node-compatible transports and storage.analytics-react-native/ - React Native SDK with AsyncStorage backend.analytics-types/ - Shared TypeScript interfaces and type aliases consumed across all packages.init not called before track: All track/identify calls before init are queued via runQueuedFunctions; always await init in tests to avoid flaky results.init with a ref or move it outside the component tree.parseLegacyCookies during init options callback and pass the returned session fields into BrowserOptions to preserve device/session IDs.tsconfig.es5.json, tsconfig.esm.json); point your bundler exports field to the ESM build for tree-shaking.tslib missing at runtime: tslib is a direct dependency; ensure it is not hoisted out of the package in monorepo setups (add to root dependencies or configure nohoist).fetch not available below v18: The FetchTransport uses native fetch; on Node < 18 install and polyfill node-fetch or upgrade Node.I have dropped the Amplitude TypeScript SDK source into `./source/` in my project.
Please read `./source/USAGE.md` for the full API reference and setup instructions.
The upstream package is `@amplitude/analytics-browser` (browser SDK) and
`@amplitude/analytics-core` (core primitives).
My project is a [TypeScript / React / Node.js / Express] application.
Please integrate Amplitude analytics step-by-step:
1. Install required dependencies listed in USAGE.md.
2. Wire tsconfig paths so imports resolve to `./source/analytics-browser/src/index.ts`.
3. Add an `amplitudeService.ts` that calls `init`, exports `track`, `identify`,
and `revenue` wrappers using the real exports from `./source/analytics-browser/src/index.ts`.
4. In my main entry file, initialize Amplitude with `process.env.AMPLITUDE_API_KEY`.
5. Track a "Page Viewed" event on each route change.
6. On user login, call `setUserId` and send an `Identify` event with `plan` and `email` properties.
7. Add a `logPurchase` helper using the `Revenue` class from `./source/analytics-core/src/index.ts`.
Use only the exports documented in USAGE.md. Do not invent any API methods.
The Amplitude TypeScript SDK is open source. See source/LICENSE if present in the repository, or refer to the GitHub repository for the current license (MIT as of the latest release). Upstream package: @amplitude/analytics-browser.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完整安装指南与集成提示词将在购买后解锁。
Automation, Utilities & Developer Tools
免费