跳过主要内容

Contentsquare Capacitor插件

在Capacitor中集成Contentsquare移动分析、-consent gating、屏幕跟踪、交易和会话回放控制

安装

bun add @capgo/capacitor-contentsquare bunx cap sync
npm、pnpm或yarn
  • npm install @capgo/capacitor-contentsquare
  • pnpm add @capgo/capacitor-contentsquare
  • yarn add @capgo/capacitor-contentsquare

指南

如何在 Capacitor 中使用 Contentsquare

使用 @capgo/capacitor-contentsquare

内部本机桥接合同由 Capacitor 实现。

安装

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个核心方法。监听器和版本辅助函数,以及每个方法的完整协议,均在__CAPGO_KEEP_0__仓库中文档化。 GitHub 仓库.

全参考

继续使用 @capgo/capacitor-contentsquare

如果您正在使用 使用 @capgo/capacitor-contentsquare 为原生插件工作做计划,连接它与 @capgo/capacitor-contentsquare 在 @capgo/capacitor-contentsquare 中了解实现细节 开始 在开始中了解实现细节 Capgo 插件目录 为产品工作流程在 Capgo 插件目录中 Capacitor 插件由 Capgo 为实现细节在 Capacitor 插件由 Capgo 中 添加或更新插件 为实现细节在添加或更新插件中

常见问题

Contentsquare插件常见问题

如何在Capacitor应用中安装Contentsquare插件?

运行"bun add @capgo/capacitor-contentsquare" (或"npm install @capgo/capacitor-contentsquare"),然后运行"bunx cap sync",使iOS和Android项目捕获native code。从"@capgo/capacitor-contentsquare"中导入它到您的应用code。

@capgo/capacitor-contentsquare与React、Vue和Angular兼容吗?

是的。Contentsquare是Capacitor包,因此它与任何运行在Capacitor中的Web框架兼容,包括Ionic、React、Vue、Angular、Svelte和纯JavaScript。

@Capacitor版本哪个版本支持@capgo/capacitor-contentsquare?

Capgo插件遵循Capacitor的主要版本:使用与Capacitor主要版本匹配的插件主要版本(例如插件v8与Capacitor 8)。在GitHub README中列出的兼容性表格列出了维护的版本。

@capgo/capacitor-contentsquare是否免费且开源?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-contentsquare/ and the package is free to install from npm.

是否可以在不经过 App Store 审核的情况下更新使用 Contentsquare 的 code?

安装或升级插件会改变原生的 code,因此需要重新构建 App Store。之后,使用 Capgo 实时更新的 JavaScript、HTML 和 CSS 变更可以立即部署。

不必等待应用审核即可将Contentsquare更改推送到商店

一旦插件在您的商店构建中,Capgo实时更新将将您的JavaScript、HTML和CSS更改推送给用户,仅需几分钟。

开始使用Capgo