跳过内容

开始获取

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);
}

If you want native code to call Apple’s attribution endpoint, pass 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 继续

如果您正在使用

Getting Started 来规划原生插件工作,连接它 来规划原生插件工作,连接它 使用 @capgo/capacitor-install-referrer 在使用 @capgo/capacitor-install-referrer 中 Capgo 插件目录 在 Capgo 插件目录 中 Capacitor 由 Capgo 提供 在 Capacitor 由 Capgo 提供 中 添加或更新插件 在添加或更新插件 中 Ionic 企业插件替代方案 在 Ionic 企业插件替代方案 中