@contentstack/personalize-edge-sdk

中文文档
1.0.28发布于 2026/10/07ISCTypeScriptCommonJS近 30 天下载 1.9万

CI

原始使用文档
文档目录4 节
  1. Getting Started
  2. Node.js
  3. Browser
  4. Initializing the SDK

CI

Contentstack Personalize JavaScript SDK

Contentstack Personalize, is the first edge-optimized personalization platform, seamlessly integrated within Contentstack’s Headless CMS.

The Personalize JavaScript SDK allows you to personalize content for your Contentstack-powered digital properties, including fetching variants for the user, triggering events, setting attributes, etc.

Getting Started

Node.js

If you have selected Node.js for your project, then use the following command to install Contentstack Personalize.

$ npm i @contentstack/personalize-edge-sdk

Browser

You can use npm i as shown above, if you're using an NPM based project setup.

Initializing the SDK

Now that we have installed the SDK, let's initialize the SDK.

Initializing the SDK is an asynchronous task as it involves fetching the manifest. Ideally, this should be done as early as possible in your application's lifecycle.

import Personalize from '@contentstack/personalize-edge-sdk';

let projectUid = 'your-project-uid';

// Using async-await:
const sdk = await Personalize.init(projectUid);

You can then fetch the active experiences as follows:

const activeExperiences = sdk.getExperiences();

Please refer to the API reference for details on how to trigger events, set attributes and more.

版本与发布记录

@contentstack/personalize-edge-sdk 共发布 15 个版本,首次发布于 2024/09/28;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.0.28latest2026/10/071 个月前
1.0.272026/08/132 个月前
1.0.232026/07/143 个月前
1.0.212026/01/229 个月前
1.0.192025/11/1311 个月前
1.0.182025/11/041 年前

关于 @contentstack/personalize-edge-sdk 的常见问题

如何安装 @contentstack/personalize-edge-sdk?

在项目目录运行 npm install @contentstack/personalize-edge-sdk,或使用 pnpm add / yarn add / bun add。

@contentstack/personalize-edge-sdk 支持 TypeScript 吗?

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

@contentstack/personalize-edge-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@contentstack/personalize-edge-sdk 可以商用吗?

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

@contentstack/personalize-edge-sdk 的下载量有多少?

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

@contentstack/personalize-edge-sdk 还在维护吗?

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