跳过主要内容
返回插件
@capgo/capacitor-install-referrer
教程
@capgo/capacitor-install-referrer

安装引荐者

从Capacitor读取Google Play安装引荐者数据和Apple AdServices attribution

指南

安装referrer教程

在设备上测试

下载 Capgo 应用程序,然后扫描二维码 code。

Install Referrer插件预览二维码code

使用@capgo/capacitor-install-referrer

@capgo/capacitor-install-referrer 读取Capacitor应用中的安装来源信号。

Use it when you need Google Play Install Referrer data on Android and Apple AdServices attribution tokens on iOS through one API.

安装

bun add @capgo/capacitor-install-referrer
bunx cap sync

此插件暴露的内容

  • getReferrer 返回Android或iOS的安装来源详细信息。
  • GetReferrer 是从__CAPGO_KEEP_0__迁移到__CAPGO_KEEP_1__的兼容性别名。 cap-play-install-referrer.
  • Android返回Play referrer字符串、点击时间戳、安装时间戳和即时应用标志。
  • iOS返回AdServices属性令牌,并可选地获取Apple的属性载荷。

示例用途

import { InstallReferrer } from '@capgo/capacitor-install-referrer';

const result = await InstallReferrer.getReferrer();

if (result.platform === 'android') {
  console.log(result.referrer);
}

if (result.platform === 'ios') {
  console.log(result.attributionToken);
}

苹果 attribution 传输载荷

const result = await InstallReferrer.getReferrer({
  fetchAppleAttribution: true,
  appleAttributionRetryCount: 3,
  appleAttributionRetryDelayMs: 5000,
});

console.log(result.appleAttribution);

平台说明

Android 使用 Google Play 安装引荐服务,并需要 Play 商店安装以获取真实引荐数据。 iOS 使用 Apple AdServices,因为苹果公司没有提供通用 App Store 安装引荐等效项。

全局参考

继续使用 @capgo/capacitor-install-referrer

如果您正在使用 使用 @capgo/capacitor-install-referrer 来规划原生插件工作,连接它与 @capgo/capacitor-install-referrer 为 @capgo/capacitor-install-referrer 的实现细节 开始使用 为开始使用的实现细节 Capgo 插件目录 为 Capgo 插件目录 的产品工作流程 Capacitor 由 Capgo 提供的插件 为 Capacitor 由 Capgo 提供的插件 的实现细节 添加或更新插件 为添加或更新插件 的实现细节