跳过内容

开始使用

  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助手来将敏感内容保留在会话重放中:

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 应用程序中实现特性,完成额外的深度链接编程 iOS 设置 页面。
  • Android 不需要为插件本身进行额外的清单编程;请参阅 Android 日志和验证提示。
  • 该插件是 Capacitor 8 社区对官方 Contentsquare Capacitor 包的翻译。
  • JavaScript API 与当前 Contentsquare Capacitor 文档保持一致,而本地构建设置和打包目标则是 Capacitor 8。