入门指南
复制一个包含安装步骤和该插件的完整 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.
-
安装插件
筺的网络安徕 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 -
Review the upstream product configuration
Follow the official Contentsquare Capacitor 指南 for project keys, replay settings, and dashboard setup.
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',});屏幕命名提示
Section titled “屏幕命名提示”- 使用稳定的名称而不是用户特定的值。
- 保持 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设置 页面。 Android不需要为插件本身进行额外的清单编程;请参阅
- Android注意事项 以获取日志和验证提示。 Android notes
说明
标题:说明- 本插件是Capgo社区的Capacitor版本,基于Contentsquare官方Capacitor包。
- The JavaScript API stays aligned with the current Contentsquare Capacitor docs, while the packaging and native build setup target Capacitor 8.