跳过内容

Getting Started

GitHub

您可以使用我们的AI辅助设置来安装插件。使用以下命令将Capgo技能添加到您的AI工具中:

终端窗口
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

然后使用以下提示:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-contentsquare` plugin in my project.

如果您prefer Manual Setup,安装插件请运行以下命令并按照以下平台特定的说明:

  1. 安装插件

    终端窗口
    npm i @capgo/capacitor-contentsquare
  2. 同步本机平台

    终端窗口
    npx cap sync
  3. 查看上游产品配置

基本使用

基本使用
import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare';
await ContentsquarePlugin.optIn();
await ContentsquarePlugin.sendScreenName('Home');
await ContentsquarePlugin.sendTransaction({
transactionValue: 29.99,
transactionCurrency: CurrencyCode.EUR,
transactionId: 'order-123',
});
await ContentsquarePlugin.sendDynamicVar({
dynVarKey: 'store',
dynVarValue: 'rome',
});

屏幕命名提示

屏幕命名提示
  • 使用稳定的名称而不是用户特定的值。
  • 保持 iOS 和 Android 导航堆栈中的命名约定一致。
  • 当应用返回前台时,重新发送屏幕名称和任何关键动态变量。

重播隐私控制

重播隐私控制

使用内置的masking助手来将敏感内容保留在Session Replay中:

await ContentsquarePlugin.excludeURLForReplay('/checkout/');
await ContentsquarePlugin.setCapturedElementsSelector('[data-cs-capture]');
await ContentsquarePlugin.setPIISelectors({
PIISelectors: ['input[type="email"]', '.credit-card'],
Attributes: [{ selector: 'input[name="email"]', attrName: 'value' }],
});

平台设置

平台设置
  • 为了 iOS 内嵌功能,完成额外的 deeplink 编程在“ iOS 设置 ”页面。
  • Android 不需要额外的清单编程来为插件本身;参见“ Android 注释 ”以获取日志和验证提示。
  • JavaScript Capacitor 与当前 Contentsquare Capacitor 文档保持一致,而打包和本机构建设置则针对 __CAPGO_KEEP_2__ 8。
  • The JavaScript API stays aligned with the current Contentsquare Capacitor docs, while the packaging and native build setup target Capacitor 8.

Keep going from Getting Started

继续从 Getting Started 中开始

如果您正在使用 Getting Started 来规划原生插件工作,连接它与 使用 @capgo/capacitor-contentsquare 为原生能力在使用 @capgo/capacitor-contentsquare 中 Capgo 原生插件目录 为产品工作流程在 Capgo 原生插件目录中 Capacitor 由 Capgo 提供的插件 为实现细节在 Capacitor 由 Capgo 提供的插件中 添加或更新插件 为实现细节在添加或更新插件中 Ionic 企业版插件替代品 为 Ionic 企业版插件替代品中的产品工作流程。