跳过内容

Getting Started

GitHub

您可以使用我们的AI辅助设置来安装插件。使用以下命令将Capgo技能添加到您的AI工具中:

终端窗口
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

然后使用以下提示:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-install-referrer` plugin in my project.

如果您更喜欢手动设置,请运行以下命令安装插件,并按照以下平台特定的说明进行操作:

终端窗口
bun add @capgo/capacitor-install-referrer
bunx cap sync
import { InstallReferrer } from '@capgo/capacitor-install-referrer';

阅读属性详情

标题:查看属性详情
const result = await InstallReferrer.getReferrer();
if (result.platform === 'android') {
console.log('Install referrer:', result.referrer);
console.log('Click timestamp:', result.clickTimestampSeconds);
console.log('Install timestamp:', result.installBeginTimestampSeconds);
}
if (result.platform === 'ios') {
console.log('AdServices token:', result.attributionToken);
}

获取苹果属性

标题:获取苹果属性

如果您希望原生code调用苹果属性端点,请传递 fetchAppleAttribution.

const result = await InstallReferrer.getReferrer({
fetchAppleAttribution: true,
appleAttributionRetryCount: 3,
appleAttributionRetryDelayMs: 5000,
});
// result.appleAttribution is the parsed Apple attribution response.
// See the iOS attribution page for the Apple-provided payload fields.
console.log(result.appleAttribution);

苹果可以返回 404 在为有效令牌准备属性数据时,属性数据仍在准备中。重试选项控制原生插件在拒绝之前多久重试。请参阅 iOS属性 查看平台详细信息。

GetReferrer() 适用于从 cap-play-install-referrer.

const result = await InstallReferrer.GetReferrer();

新code应使用 getReferrer().

如果您正在使用 Getting Started 来规划原生插件工作,连接它到 使用 @capgo/capacitor-install-referrer 为原生能力在使用 @capgo/capacitor-install-referrer Capgo 插件目录 为产品工作流程在 Capgo 插件目录, Capacitor 由 Capgo 提供的插件 为 Capacitor 由 Capgo 提供的插件中的实现细节 添加或更新插件 为添加或更新插件中的实现细节,并 Ionic 企业插件替代品 为 Ionic 企业插件替代品中的产品工作流