Getting Started
复制一个包含安装步骤和完整 Markdown 指南的设定提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-contentsquare`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/contentsquare/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
安装您可以使用我们的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.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
-
安装插件
终端窗口 npm i @capgo/capacitor-contentsquare终端窗口 pnpm add @capgo/capacitor-contentsquare终端窗口 yarn add @capgo/capacitor-contentsquare终端窗口 bun add @capgo/capacitor-contentsquare -
同步本机平台
终端窗口 npx cap sync终端窗口 pnpm cap sync终端窗口 yarn cap sync终端窗口 bunx cap sync -
查看上游产品配置
遵循官方 Contentsquare Capacitor 指南 用于项目密钥、重播设置和仪表板设置。
基本使用
标题为“基本使用”的部分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 注释 以获取日志和验证提示。
注释
标题:注释- 本插件是 Capacitor 8 社区版的官方 Contentsquare Capacitor 包。
- JavaScript API 与当前 Contentsquare Capacitor 文档保持一致,而打包和原生构建设置则针对 Capacitor 8。
继续从 Getting Started
如果您正在使用Getting Started 来规划原生插件工作,连接它到 使用 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-contentsquare 在使用 @capgo/capacitor-contentsquare 中的原生能力 for the native capability in Using @capgo/capacitor-contentsquare, 在 Capgo 插件目录 中的产品工作流 Capgo 由 __CAPGO_KEEP_1__ 的插件 在 Capacitor 由 Capgo 的插件 中的实现细节 for the implementation detail in Capacitor Plugins by Capgo, 添加或更新插件 为添加或更新插件的实现细节 Ionic 企业插件替代品 为 Ionic 企业插件替代品的产品工作流程