跳过内容

开始使用

终端窗口
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';

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

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

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

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

记录应用内事件。

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

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

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

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

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

updateServerUninstallToken

标题:更新服务器卸载令牌

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

setOneLinkCustomDomain

标题:设置自定义域

注册品牌 OneLink 域名,使 AppsFlyer 可以解析短链中的属性参数。

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

appendParametersToDeepLinkingURL

标题:附加参数到深度链接 URL

启用 App Links 深度链接的属性功能,无需 OneLink。请在调用此方法之前 startSDK()至少包含 pidis_retargeting=true 在参数映射中。

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

setResolveDeepLinkURLs

标题:解析深度链接 URL

当 AppsFlyer 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);

阻止事件传播到指定的AppsFlyer合作伙伴。

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

用户退出 AppsFlyer 分析(匿名化用户数据)。

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

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

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

disableSKAdNetwork

标题:禁用SKAdNetwork

禁用SKAdNetwork

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

disableAdvertisingIdentifier

标题:禁用广告标识符

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

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

disableCollectASA

标题:禁用ASA收集

禁用苹果搜索广告的归因

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

查看当前合同的源定义

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

获取 AppsFlyer SDK 版本,应用中使用

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getSdkVersion();
标题:"enableFacebookDeferredApplinks"

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

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

sendPushNotificationData

标题:"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"

作为跨促销活动的一部分,记录一次印象。确保使用AppsFlyer控制台中显示的推广应用ID。

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

设置用户电子邮件并加密它们。

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

手动记录用户位置

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

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

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

允许为合作伙伴集成目的发送自定义数据。

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

用于在应用程序内记录用户邀请事件(af_invite)。

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

setDisableNetworkData

标题:setDisableNetworkData

用于在设备上禁用收集网络运营商名称(运营商)和SIM卡运营商名称的功能。

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

enableTCFDataCollection

标题:enableTCFDataCollection

用于启用/禁用自动收集同意数据,针对使用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);

使用此方法检查是否在当前会话中已启动AppsFlyerSDK。

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

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

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上游更改时,请重新运行同步。