指南
如何在 Capacitor 中使用 Contentsquare
使用 @capgo/capacitor-contentsquare
由 Capacitor 实现的内部 Native Bridge 协议
安装
bun add @capgo/capacitor-contentsquare
bunx cap sync
bunx cap sync 将插件的原生 code 复制到你的原生项目中。每次升级插件后都要重新运行。
导入
import { Contentsquare } from '@capgo/capacitor-contentsquare';
API 概览
| 方法 | 描述 |
|---|---|
optIn |
查看源码定义以了解当前行为。 |
optOut |
查看源码定义以了解当前行为。 |
sendScreenName |
查看源码定义以了解当前行为。 |
sendTransaction |
查看源码定义以了解当前行为。 |
sendDynamicVarWithStringValue |
查看源码定义以了解当前行为。 |
sendDynamicVarWithIntValue |
查看源码定义以了解当前行为。 |
onReady |
查看源码定义以了解当前行为。 |
excludeURLForReplay |
查看源码定义以了解当前行为。 |
setPIISelectors |
查看源码定义以了解当前行为。 |
setCapturedElementsSelector |
查看源码定义以了解当前行为。 |
collect |
查看源码定义以了解当前行为。 |
示例
optIn()
查看 API 参考文档以了解当前契约。
import { Contentsquare } from '@capgo/capacitor-contentsquare';
await Contentsquare.optIn();
optOut()
查看 API 参考文档以了解当前契约。
import { Contentsquare } from '@capgo/capacitor-contentsquare';
await Contentsquare.optOut();
sendScreenName()
查看 API 参考文档以了解当前契约。
import { Contentsquare } from '@capgo/capacitor-contentsquare';
await Contentsquare.sendScreenName({ name: 'example' });
sendTransaction()
查看 API 参考文档以了解当前契约。
import { Contentsquare, CurrencyCode } from '@capgo/capacitor-contentsquare';
await Contentsquare.sendTransaction({
transactionValue: 1,
transactionCurrency: CurrencyCode.USD,
});
sendDynamicVarWithStringValue()
查看 API 参考文档以了解当前契约。
import { Contentsquare } from '@capgo/capacitor-contentsquare';
await Contentsquare.sendDynamicVarWithStringValue({
dynVarKey: 'dyn-var-key-123',
dynVarValue: 'dyn-var-value',
});
sendDynamicVarWithIntValue()
查看 API 参考文档以了解当前契约。
import { Contentsquare } from '@capgo/capacitor-contentsquare';
await Contentsquare.sendDynamicVarWithIntValue({
dynVarKey: 'dyn-var-key-123',
dynVarValue: 'dyn-var-value',
});
上表列出了 11 个核心方法。有关 Listener 和 version 辅助函数以及每个方法的完整契约,请参阅 GitHub 仓库.
完整参考文档
继续阅读 使用 @capgo/capacitor-contentsquare
如果你正在使用 使用 @capgo/capacitor-contentsquare 要规划原生插件工作,请将其与 @capgo/capacitor-contentsquare 以了解 @capgo/capacitor-contentsquare 中的实现细节, 快速入门 有关“入门指南”中的实现细节, Capgo 插件目录 查看 Capgo 插件目录中的产品工作流, Capgo 提供的 Capacitor 插件 有关 Capgo 开发的 Capacitor 插件的实现细节,以及 添加或更新插件 有关添加或更新插件的实现细节。