@getdevteam/analytics-core

中文文档
0.13.0发布于 2026/11/13MITTypeScriptESM + CJS近 30 天下载 6.5万

Platform-agnostic core client for the DevTeam analytics and logging platform.

原始使用文档

@getdevteam/analytics-core

Platform-agnostic core client for the DevTeam Analytics & Logging Platform. Use this directly from Node or any custom JS runtime. For a browser app use @getdevteam/analytics-web instead.

Install

npm install @getdevteam/analytics-core

Use

import { createClient } from "@getdevteam/analytics-core";

const analytics = createClient({
  key: "dti_your_server_key",              // DEVTEAM_ANALYTICS_SERVER_KEY, the server ingest key
  host: "https://ingest.analytics.getdevteam.ai",
  serviceName: "checkout-worker",
});

analytics.track("invoice_generated", { amount: 4200 });
await analytics.flush();   // call before your process exits

Pass release: { version, commit } to attribute every event and log to a build; without it the client reads globalThis.__DEVTEAM_RELEASE__, then DEVTEAM_RELEASE_VERSION / DEVTEAM_COMMIT_SHA from process.env, which Devteam sets on every deploy.

You need an ingest key and the ingest host URL for your environment - see Getting a key in the full SDK docs. On a server, use the environment's server ingest key (dti_, published by DevTeam as the secret DEVTEAM_ANALYTICS_SERVER_KEY): it can only send data, and what it sends is stamped trust = 'server', while data sent with the public dtp_ key is stamped client. Never send with the secret dts_ key, which can also read all of the project's data.

Full client API, config options, and release process: src/sdk README.

版本与发布记录

@getdevteam/analytics-core 共发布 20 个版本,首次发布于 2026/07/05;过去 12 个月发布了 20 个版本。

版本发布日期距今
0.13.0latest2026/11/133 天前
0.12.02026/11/106 天前
0.11.02026/11/097 天前
0.10.02026/11/0213 天前
0.9.02026/11/0213 天前
0.8.32026/10/2917 天前

其他发布通道:dev → 0.1.0-dev.2。

关于 @getdevteam/analytics-core 的常见问题

@getdevteam/analytics-core 是什么?

Platform-agnostic core client for the DevTeam analytics and logging platform.

如何安装 @getdevteam/analytics-core?

在项目目录运行 npm install @getdevteam/analytics-core,或使用 pnpm add / yarn add / bun add。

@getdevteam/analytics-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@getdevteam/analytics-core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@getdevteam/analytics-core 可以商用吗?

@getdevteam/analytics-core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@getdevteam/analytics-core 的下载量有多少?

根据 npm 官方下载统计,@getdevteam/analytics-core 在 2026/10/17 – 2026/11/15 这 30 天内被下载 65,283 次,日均约 2,176 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@getdevteam/analytics-core 还在维护吗?

最新版本 0.13.0 发布于 2026/11/13(3 天前);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/07/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。