跳过内容

开始获取

GitHub

安装

安装
终端窗口
bun add @capgo/capacitor-appsflyer
bunx cap sync

导入

导入
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
import type {
AFAdRevenueData,
AFAndroidInAppPurchase,
AFAnonymizeUser,
AFAppendToDeepLink,
AFConsentData,
AFConsentOptions,
AFCuid,
AFCurrency,
AFData,
AFDisable,
AFEmails,
AFEnableTCFDataCollection,
AFEvent,
AFFbDAL,
AFFilters,
AFHost,
AFInit,
AFIosInAppPurchase,
AFLanguage,
AFLatLng,
AFLinkGenerator,
AFLogInvite,
AFOnelinkDomain,
AFOnelinkID,
AFPartnerData,
AFPath,
AFPhone,
AFPromotion,
AFPurchaseDetailsV2,
AFPushPayload,
AFUninstall,
AFUrls,
} from '@capgo/capacitor-appsflyer';

API概述

API概述

initSDK

initSDK

使用此方法初始化并启动AppsFlyer SDK。此 API 应该在应用程序启动时立即调用。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.initSDK({} as AFInit);

startSDK

开始SDK

仅在手动启动模式下使用此方法启动 AppsFlyer SDK。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.startSDK();

logEvent

日志事件

在应用中记录事件。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logEvent({} as AFEvent);

setCustomerUserId

设置客户ID

设置客户ID使您可以将自己的唯一ID与AppsFlyer的唯一ID和其他设备的ID进行交叉引用。 此ID可在原始数据报告和Postback API中找到,用于与内部ID进行交叉引用。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCustomerUserId({} as AFCuid);

setCurrencyCode

设置货币代码

设置应用内购买的货币。提供三位字符的ISO 4217 code。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrencyCode({} as AFCurrency);

在 Android 上传递 GCM/FCM 代币,或在 iOS 上传递 APNs 代币,另一个插件收集它们。 将卸载测量代币传递给 AppsFlyer。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.updateServerUninstallToken({} as AFUninstall);

设置用于邀请归因的 OneLink ID 作为邀请链接的基本链接。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAppInviteOneLink({} as AFOnelinkID);

注册自定义 OneLink 域名,以便 AppsFlyer 可以解析短链中的归因参数。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setOneLinkCustomDomain({} as AFOnelinkDomain);

在 App Links 深度链接中启用归因,未使用 OneLink 的情况下。请在此方法之前调用。 至少包含 startSDK()复制到剪贴板 pid and is_retargeting=true 在参数映射中。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.appendParametersToDeepLinkingURL({} as AFAppendToDeepLink);

setResolveDeepLinkURLs

标题:设置深度链接URLs

当应用Flyer OneLink 包含在另一个 Universal Link 内时使用。 它让 SDK 解析包裹的URL,因此深度链接仍然正常工作。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setResolveDeepLinkURLs({} as AFUrls);

addPushNotificationDeepLinkPath

标题:添加推送通知深度链接路径

配置 SDK 从推送通知包裹中提取深度链接值的方式。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.addPushNotificationDeepLinkPath({} as AFPath);

阻止事件传播到指定的应用Flyer 合作伙伴。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilter({} as AFFilters);

阻止所有 AppsFlyer 合作伙伴接收事件。 覆盖 setSharingFilter。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForAllPartners();

阻止特定 AppsFlyer 合作伙伴接收事件。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForPartners({} as AFFilters);

设置额外的键值对数据发送到 AppsFlyer。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAdditionalData({} as AFData);

获取 AppsFlyer 的唯一设备 ID(每个新安装的应用程序都会创建一个)。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getAppsFlyerUID();

End User Opt-Out from AppsFlyer analytics (匿名化用户数据).

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.anonymizeUser({} as AFAnonymizeUser);

一旦调用了这个 API,我们的 SDK 就不会再与我们的服务器通信并停止运行。 在实现用户自愿或不自愿时有用。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.stop();

禁用 SKAdNetwork

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableSKAdNetwork({} as AFDisable);

disableAdvertisingIdentifier

Section titled “禁用广告标识符”

禁用 SDK 收集各种广告 ID。这包括苹果广告商标识符 (IDFA)、谷歌广告 ID (GAID)、OAID 和亚马逊广告 ID (AAID)。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAdvertisingIdentifier({} as AFDisable);

退出苹果搜索广告的贡献。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableCollectASA({} as AFDisable);

设置自定义主机。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setHost({} as AFHost);

允许您的现有用户邀请他们的朋友和联系人作为新用户加入您的应用。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.generateInviteLink({} as AFLinkGenerator);

API用于服务器验证应用内购买。 如果验证成功,会自动记录一个af_purchase事件,包含相关值。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseAndroid({} as AFAndroidInAppPurchase);

validateAndLogInAppPurchaseIos

验证并登录iOS应用

查看当前合同的源定义。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseIos({} as AFIosInAppPurchase);

getSdkVersion

获取SDK版本

获取应用Flyer SDK 版本

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getSdkVersion();
Facebook延迟应用链接的收集

启用Facebook延迟应用链接的收集。需要Facebook SDK 和目标/客户端设备上的Facebook应用。 此 API 必须在初始化应用Flyer SDK 之前调用,以正常工作。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableFacebookDeferredApplinks({} as AFFbDAL);

sendPushNotificationData

推送通知数据测量

从推送通知活动中获取数据。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.sendPushNotificationData({} as AFPushPayload);

setCurrentDeviceLanguage

setCurrentDeviceLanguage

设置设备语言。数据将在原始数据报告中显示

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrentDeviceLanguage({} as AFLanguage);

logCrossPromoteImpression

logCrossPromoteImpression

在跨促销活动中记录一次 impression。确保使用 AppsFlyer 控制台中显示的推广应用 ID

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logCrossPromoteImpression({} as AFPromotion);

setUserEmails

setUserEmails

设置用户电子邮件并加密

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setUserEmails({} as AFEmails);

logLocation

logLocation

手动记录用户位置

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logLocation({} as AFLatLng);

setPhoneNumber

设置手机号

将以SHA-256加密的字符串形式发送。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPhoneNumber({} as AFPhone);

用于合作伙伴集成目的发送自定义数据。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPartnerData({} as AFPartnerData);

复制到剪贴板

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logInvite({} as AFLogInvite);

复制到剪贴板

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setDisableNetworkData({} as AFDisable);

用于启用/禁用自动收集用户同意数据,适用于使用CMP的用户。 标志值将在应用程序会话之间持久化。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableTCFDataCollection({} as AFEnableTCFDataCollection);

使用此方法手动设置用户同意数据。 如果您的应用程序不使用与TCF v2.2兼容的CMP,请使用以下方法手动提供同意数据直接到SDK。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentData({} as AFConsentData);

通过为广告收入进行归因,应用程序所有者可以获得完整的用户LTV和营销活动ROI视图。 广告收入是通过在应用程序中显示奖励视频、推广墙、插屏广告和横幅广告来产生的。 您可以使用此方法记录您的广告收入。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logAdRevenue({} as AFAdRevenueData);

使用此方法手动设置用户同意数据。 如果您的应用程序不使用与TCF v2.2兼容的CMP,请使用以下方法手动提供同意数据直接到SDK。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentDataV2({} as AFConsentOptions);

使用此方法检查当前会话中是否已经启动了 AppsFlyer SDK。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStarted();

使用此方法检查 AppsFlyer SDK 是否当前处于停止状态。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStopped();

禁用 AppSet ID 收集。若在 SDK 初始化之前调用,则 App Set ID 不会被收集。若在初始化之后调用,则 App Set ID 会被收集但不会在请求包中发送。仅限 Android。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAppSetId();

API 服务器端验证应用内购买 V2。 如果验证成功,则会自动记录 af_purchase 事件及其相关值。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseV2({} as AFPurchaseDetailsV2);

数据源

数据源

本页面由插件生成 src/definitions.ts当公共API发生更改时,请重新同步

继续从开始

继续从开始

如果您正在使用 开始 规划仪表板和API操作,请将其连接到 使用@capgo/capacitor-appsflyer 在使用@capgo/capacitor-appsflyer时,native能力 API概述 为实现细节在 API 概述中 简介 为实现细节在简介中 API 密钥 为实现细节在 API 密钥中,以及 设备 为实现细节在设备中。