开始
复制一个包含安装步骤和该插件的完整 Markdown 指南的设置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-install-referrer`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/install-referrer/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
标题:安装bun add @capgo/capacitor-install-referrerbunx 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);}在 iOS 上获取 Apple 属性
导入部分如果您希望本地 code 调用 Apple 的属性端点,请传递 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);Apple 可以返回 404 当有有效令牌时, attribution 数据仍在准备中。重试选项控制原生插件在拒绝之前重试的频率。请参见 iOS 属性 有关平台详细信息。
兼容性别名
兼容性别名GetReferrer() 可用于从 cap-play-install-referrer.
const result = await InstallReferrer.GetReferrer();新 code 应该使用 getReferrer().
继续从 Getting Started
如果您正在使用iOS 属性 开始使用 为了native插件的工作,连接它与 使用@capgo/capacitor-install-referrer 在使用@capgo/capacitor-install-referrer中,native能力 Capgo插件目录 在Capgo插件目录中,产品工作流 Capacitor由Capgo的插件 在Capacitor由Capgo的插件中,实现细节 添加或更新插件 添加或更新插件的实现细节, Ionic企业插件替代方案 在Ionic企业插件替代方案中,产品工作流