跳过内容

开始使用

  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内购功能的实现需要在iOS设置页面完成额外的深度链接配置。 iOS设置 Android不需要为插件本身进行额外的清单配置;请参阅
  • Android注意事项 Android notes 注意事项
  • This plugin is a Capacitor 8 community port of the official Contentsquare Capacitor package.
  • The JavaScript API stays aligned with the current Contentsquare Capacitor docs, while the packaging and native build setup target Capacitor 8.