Referência da API
APIs
A lista de métodos disponíveis para este plugin está descrita abaixo.
- APIs
- Android and iOS APIs
- initSdk
- startSDK
- logEvent
- setCustomerUserId
- stop
- setAppInviteOneLinkID
- setAdditionalData
- setResolveDeepLinkURLs
- setOneLinkCustomDomains
- setCurrencyCode
- logLocation
- anonymizeUser
- getAppsFlyerUID
- setHost
- setUserEmails
- generateInviteLink
- setSharingFilterForAllPartners
- setSharingFilter
- setSharingFilterForPartners
- validateAndLogInAppPurchase
- updateServerUninstallToken
- sendPushNotificationData
- addPushNotificationDeepLinkPath
- appendParametersToDeepLinkingURL
- disableAdvertisingIdentifier
- enableTCFDataCollection
- setConsentData
- logAdRevenue
- APIs somente para Android
- APIs somente para iOS
- AppsFlyerConversionData
Android and iOS APIs
initSdk
initSdk(options, success, error)
Inicialize o SDK da AppsFlyer com o devKey e o appID.
A chave do desenvolvedor é necessária para todos os aplicativos e o appID é necessário apenas para iOS.
(você pode passar o appID no Android também, e ele será ignorado)
parameter | type | description |
---|---|---|
options | JSON | inicia as opções |
sucesso | function | success callback |
erro | function | callback de erro |
Configuração | Descrição |
---|---|
Chave do desenvolvedor (Dev key) | Your application devKey provided by AppsFlyer (required) |
App ID | App ID (iOS only) you configured in your AppsFlyer dashboard |
isDebug | Modo de depuração - definido como true somente teste |
onInstallConversionDataListener | Set listener for GCD response (Optional. default=true) |
onDeepLinkListener | Set listener for UDL response (Optional. default=false) |
timeToWaitForATTUserAuthorization | Waits for request user authorization to access app-related data. please read more Here |
manualStart | Prevents from the SDK from sending the launch request after using appsFlyer.initSdk(...). When using this property, the apps needs to manually trigger the appsFlyer.startSdk() API to report the app launch. read more here. (Optional, default=false) |
Exemplo:
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import appsFlyer from 'react-native-appsflyer';
appsFlyer.initSdk(
{
devKey: 'K2***********99',
isDebug: false,
appId: '41*****44',
onInstallConversionDataListener: false, //Optional
onDeepLinkListener: true, //Optional
timeToWaitForATTUserAuthorization: 10, //for iOS 14.5
manualStart: true, //Optional
},
(res) => {
console.log(res);
},
(err) => {
console.error(err);
}
);
startSdk
startSdk()
Na versão 6.9.1 do SDK react-native-appslfyer, adicionamos a opção de divisão entre o estágio de inicialização e o estágio inicial. Tudo o que você precisa fazer é adicionar a propriedade manualStart: true ao objeto init e, depois, chamar appsFlyer.startSdk() sempre que você decidir. Se esta propriedade estiver definida como falso ou não existir, o SDK será iniciado após chamar appsFlyer.initSdk(...)
.
Exemplo:
const option = {
isDebug: true,
devKey: 'UsxXxXxed',
appId: '75xXxXxXxXx11',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 5,
manualStart: true, // <--- for manual start.
};
appsFlyer.initSdk(
option,
() => {
if (!option.manualStart) {
console.warn('AppsFlyer SDK started!');
} else {
console.warn('AppsFlyer SDK init, didn\'t send launch yet');
}
},
err => {
// handle error
},
);
//...
// app flow
//...
appsFlyer.startSdk(); // <--- Here we send launch
logEvent
logEvent(eventName, eventValues, success, error)
Eventos in-app fornecem insights sobre o que está acontecendo em seu aplicativo. É aconselhável investir tempo para definir os eventos que você deseja avaliar para permitir medir o ROI (retorno sobre o investimento) e LTV (valor de vida útil).
A gravação de eventos in-app é realizada chamando logEvent com parâmetros de nome e valor do evento. Consulte a documentação sobre Eventos in-app para obter mais detalhes.
Observação: o nome de um evento in-app não deve ter mais de 45 caracteres. Nomes de eventos com mais de 45 caracteres não aparecem no painel, apenas nas APIs de dados brutos, Pull e Push.
parameter | type | description |
---|---|---|
eventName | string | O nome do evento |
Valores do evento | JSON | Os valores de evento que são enviados com o evento |
sucesso | function | success callback |
erro | function | success callback |
Exemplo:
const eventName = 'af_add_to_cart';
const eventValues = {
af_content_id: 'id123',
af_currency: 'USD',
af_revenue: '2',
};
appsFlyer.logEvent(
eventName,
eventValues,
(res) => {
console.log(res);
},
(err) => {
console.error(err);
}
);
setCustomerUserId
setCustomerUserId(userId, callback)
Definir seu próprio ID personalizado permite que você faça referência cruzada de seu próprio ID exclusivo com o ID de usuário da AppsFlyer e os IDs de outros dispositivos. Esse ID está disponível nos relatórios de CSV da AppsFlyer juntamente com APIs de postbacks para referência cruzada com seus IDs internos.
Se você deseja ver o CUID (ID do usuário do cliente) em seus relatórios de dados brutos de instalações, ele deve ser chamado antes de iniciar o SDK.
Se você simplesmente deseja adicionar um ID de usuário adicional aos relatórios de dados brutos de eventos, pode chamá-lo livremente sempre que precisar.
parameter | type | description |
---|---|---|
userId | string | ID do usuário |
callback | function | success callback |
Exemplo:
appsFlyer.setCustomerUserId('some_user_id', (res) => {
//..
});
stop
stop(isStopped, callback)
Em alguns casos extremos, convém encerrar todas as funções do SDK devido à conformidade legal e de privacidade. Isso pode ser obtido com a API stopSDK. Depois que essa API é chamada, nosso SDK não se comunica mais com nossos servidores e deixa de funcionar.
Há vários cenários diferentes para a exclusão (opt-out) de usuários. É altamente recomendável seguir as instruções exatas para o cenário, que são relevantes para o seu aplicativo.
Em qualquer evento, o SDK pode ser reativado chamando a mesma API passando o valor "false".
parameter | type | description |
---|---|---|
isStopped | Booleano | Verdadeiro se o SDK for interrompido (o valor padrão é falso). |
callback | function | success callback |
Exemplo:
appsFlyer.stop(true, (res) => {
//...
});
setAppInviteOneLinkID
setAppInviteOneLinkID(oneLinkID, callback)
Defina o OneLink ID que deve ser usado para User-Invite-API.
O link gerado para o convite do usuário usará esse ID do OneLink como o ID do link base.
parameter | type | description |
---|---|---|
ID do OneLink | string | ID do OneLink |
callback | function | success callback |
Exemplo:
appsFlyer.setAppInviteOneLinkID('abcd', (res) => {
//...
});
setAdditionalData
setAdditionalData(additionalData, callback)
A API setAdditionalData é necessária para integrar no nível do SDK com várias plataformas de parceiros externos, incluindo Segment, Adobe e Urban Airship. Use esta API somente se o artigo de integração da plataforma declarar especificamente que a API setAdditionalData é necessária.
parameter | type | description |
---|---|---|
dados adicionais | JSON | dados adicionais |
callback | function | success callback |
Exemplo:
appsFlyer.setAdditionalData(
{
val1: 'data1',
val2: false,
val3: 23,
},
(res) => {
//...
}
);
setResolveDeepLinkURLs
setResolveDeepLinkURLs(urls, successC, errorC)
Set domains used by ESP when wrapping your deeplinks.
Use this API during the SDK Initialization to indicate that links from certain domains should be resolved in order to get original deeplink
For more information please refer to the documentation
parameter | type | description |
---|---|---|
urls | Array | Matriz separada por vírgulas de domínios ESP que requerem resolução |
successC | function | success callback |
errorC | function | callback de erro |
Exemplo:
appsFlyer.setResolveDeepLinkURLs(["click.esp-domain.com"],
(res) => {
console.log(res);
}, (error) => {
console.log(error);
});
setOneLinkCustomDomains
setOneLinkCustomDomains(domains, successC, errorC)
Set Onelink custom/branded domains
Use this API during the SDK Initialization to indicate branded domains.
For more information please refer to the documentation
parameter | type | description |
---|---|---|
domains | Array | Matriz separada por vírgulas de domínios de marca |
successC | function | success callback |
errorC | function | callback de erro |
Exemplo:
appsFlyer.setOneLinkCustomDomains(["click.mybrand.com"],
(res) => {
console.log(res);
}, (error) => {
console.log(error);
});
setCurrencyCode
setCurrencyCode(currencyCode, callback)
Setting user local currency code for in-app purchases.
The currency code should be a 3 character ISO 4217 code. (default is USD).
You can set the currency code for all events by calling the following method.
parameter | type | description |
---|---|---|
currencyCode | string | currencyCode |
callback | function | success callback |
Exemplo:
appsFlyer.setCurrencyCode(currencyCode, () => {});
logLocation
logLocation(longitude, latitude, callback)
Registre manualmente a localização do usuário.
parameter | type | description |
---|---|---|
LONGITUDE | float | LONGITUDE |
LATITUDE | float | LATITUDE |
callback | function | Callbacks de sucesso/erro |
Exemplo:
const latitude = -18.406655;
const longitude = 46.40625;
appsFlyer.logLocation(longitude, latitude, (err, coords) => {
if (err) {
console.error(err);
} else {
//...
}
});
anonymizeUser
anonymizeUser(shouldAnonymize, callback)
It is possible to anonymize specific user identifiers within AppsFlyer analytics.
This complies with both the latest privacy requirements (GDPR, COPPA) and Facebook's data and privacy policies.
To anonymize an app user.
parameter | type | description |
---|---|---|
shouldAnonymize | Booleano | Verdadeiro se desejar anonimizar os dados do usuário (o valor padrão é falso). |
callback | function | success callback |
Exemplo:
appsFlyer.anonymizeUser(true, () => {});
getAppsFlyerUID
getAppsFlyerUID(callback)
O ID de dispositivo exclusivo da AppsFlyer é criado para cada nova instalação de um aplicativo. Use a API a seguir para obter o ID exclusivo da AppsFlyer.
parameter | type | description |
---|---|---|
callback | function | Retorna (error, appsFlyerUID) |
Exemplo:
appsFlyer.getAppsFlyerUID((err, appsFlyerUID) => {
if (err) {
console.error(err);
} else {
console.log('on getAppsFlyerUID: ' + appsFlyerUID);
}
});
setHost
setHost(hostPrefix, hostName, successC)
Defina um host personalizado
parameter | type | description |
---|---|---|
hostPrefix | string | o prefixo do host |
hostName | string | o nome do host |
successC | function | success callback |
Exemplo:
appsFlyer.setHost('foo', 'bar.appsflyer.com', res => console.log(res));
setUserEmails
setUserEmails(options, success, error)
Set the user emails and encrypt them.
Note: Android and iOS platforms supports only 0 (none) and 3 (SHA256) emailsCryptType.
When unsupported emailsCryptType is passed, the SDK will use the default (none).
parameter | type | description |
---|---|---|
configuration | JSON | configuração de e-mail |
sucesso | function | success callback |
erro | function | callback de erro |
option | type | description |
---|---|---|
emailsCryptType | int | none - 0 (default), SHA256 - 3 |
e-mails | Array | lista de e-mails separados por vírgula |
Exemplo:
const options = {
// In this case iOS platform will encrypt emails usind MD5 and android with SHA256. If you want both platform to encrypt with the same method, just write 0 or 3.
emailsCryptType: Platform.OS === 'ios' ? 2 : 3,
emails: ['[email protected]', '[email protected]'],
};
appsFlyer.setUserEmails(
options,
(res) => {
//...
},
(err) => {
console.error(err);
}
);
generateInviteLink
generateInviteLink(parameters, success, error)
parameter | type | description |
---|---|---|
Parâmetros | JSON | Parâmetros para link de convite |
sucesso | function | Callback de sucesso (link gerado) |
erro | function | callback de erro |
Exemplo:
appsFlyer.generateInviteLink(
{
channel: 'gmail',
campaign: 'myCampaign',
customerID: '1234',
userParams: {
myParam: 'newUser',
anotherParam: 'fromWeb',
amount: 1,
},
},
(link) => {
console.log(link);
},
(err) => {
console.log(err);
}
);
A complete list of supported parameters is available here. Custom parameters can be passed using a userParams{} nested object, as in the example above.
setSharingFilterForAllPartners
setSharingFilterForAllPartners()
Deprecated! Start from version 6.4.0 please use setSharingFilterForPartners
Used by advertisers to exclude all networks/integrated partners from getting data. Learn more here
Exemplo:
appsFlyer.setSharingFilterForAllPartners()
setSharingFilter
setSharingFilter(partners, sucessC, errorC)
Deprecated! Start from version 6.4.0 please use setSharingFilterForPartners
Used by advertisers to exclude specified networks/integrated partners from getting data. Learn more here
parameter | type | description |
---|---|---|
parceiros | Array | Matriz separada por vírgulas de parceiros que precisam ser excluídos |
successC | function | success callback |
errorC | function | callback de erro |
Exemplo:
let partners = ["facebook_int","googleadwords_int","snapchat_int","doubleclick_int"]
appsFlyer.setSharingFilterForAllPartners(partners,
(res) => {
console.log(res);
}, (error) => {
console.log(error);
})
setSharingFilterForPartners
setSharingFilterForPartners(partners)
Usado por anunciantes para impedir que redes/parceiros integrados obtenham dados.
parameter | type | description |
---|---|---|
parceiros | Array | Matriz separada por vírgulas de parceiros que precisam ser excluídos |
Exemplo:
appsFlyer.setSharingFilterForPartners([]); // Reset list (default)
appsFlyer.setSharingFilterForPartners(null); // Reset list (default)
appsFlyer.setSharingFilterForPartners(['facebook_int']); // Single partner
appsFlyer.setSharingFilterForPartners(['facebook_int', 'googleadwords_int']); // Multiple partners
appsFlyer.setSharingFilterForPartners(['all']); // All partners
appsFlyer.setSharingFilterForPartners(['googleadwords_int', 'all']); // All partners
validateAndLogInAppPurchase
validateAndLogInAppPurchase(purchaseInfo, successC, errorC): Response<string>
Receipt validation is a secure mechanism whereby the payment platform (e.g. Apple or Google) validates that an in-app purchase indeed occurred as reported.
Learn more - https://support.appsflyer.com/hc/en-us/articles/207032106-Receipt-validation-for-in-app-purchases
❗Important❗ for iOS - set SandBox to true
appsFlyer.setUseReceiptValidationSandbox(true);
parameter | type | description |
---|---|---|
purchaseInfo | JSON | Parâmetros de compra in-app |
successC | function | Callback de sucesso (link gerado) |
errorC | function | callback de erro |
Exemplo:
let info = {
publicKey: 'key',
currency: 'biz',
signature: 'sig',
purchaseData: 'data',
price: '123',
productIdentifier: 'identifier',
currency: 'USD',
transactionId: '1000000614252747',
additionalParameters: {'foo': 'bar'},
};
appsFlyer.validateAndLogInAppPurchase(info, res => console.log(res), err => console.log(err));
updateServerUninstallToken
updateServerUninstallToken(token, callback)
Passe manualmente o Firebase/GCM Device Token para medição de desinstalação.
parameter | type | description |
---|---|---|
token | string | Token FCM |
callback | function | success callback |
Exemplo:
appsFlyer.updateServerUninstallToken('token', (res) => {
//...
});
sendPushNotificationData
sendPushNotificationData(pushPayload, ErrorCB): void
Push-notification campaigns are used to create fast re-engagements with existing users.
Learn more
For Android platform, AppsFlyer SDK uses the activity in order to process the push payload. Make sure you call this api when the app's activity is available (NOT dead state).
From version 6.6.0 we added an error callback that returns an error message.
parameter | type | description |
---|---|---|
pushPayload | JSON | payload de notificação push |
ErrorCB | function | retorna uma mensagem de erro quando o payload não foi enviado |
Exemplo:
const pushPayload = {
af:{
c:"test_campaign",
is_retargeting:true,
pid:"push_provider_int",
},
aps:{
alert:"Get 5000 Coins",
badge:"37",
sound:"default"
}
};
appsFlyer.sendPushNotificationData(pushPayload, err => console.log(err));
addPushNotificationDeepLinkPath
addPushNotificationDeepLinkPath(path, SuccessCB, ErrorCB): void
Adiciona uma matriz de chaves, que são usadas para compor o caminho da chave para resolver o deep link a partir do payload da notificação push.
parameter | type | description |
---|---|---|
path | Array | matriz de sequências de caracteres que corresponde ao caminho JSON do deep link. |
successCB | function | success callback |
errorCB | function | callback de erro |
Exemplo:
let path = ['deeply', 'nested', 'deep_link'];
appsFlyer.addPushNotificationDeepLinkPath(
path,
res => console.log(res),
error => console.log(error),
);
Esta chamada corresponde à seguinte estrutura de payload:
{
...
"deeply": {
"nested": {
"deep_link": "https://yourdeeplink2.onelink.me"
}
}
...
}
appendParametersToDeepLinkingURL
appendParametersToDeepLinkingURL(contains, parameters): void
Corresponde a URLs que contêm contains
as a substring and appends query parameters to them. In case the URL does not match, parameters are not appended to it.
Note:
- The
parameters
deve ser composto porstring
e valorstring
valor - Chame esta API antes de chamar
appsFlyer.initSDK()
- Você deve fornecer os seguintes parâmetros:
pid
,is_retargeting
deve ser definido como'true'
parameter | type | description |
---|---|---|
contém | string | A sequência de caracteres para verificar no URL |
Parâmetros | object | Parâmetros a serem anexados ao URL do deep link após a validação |
Exemplo:
appsFlyer.appendParametersToDeepLinkingURL('substring-of-url', {param1: 'value', pid: 'value2', is_retargeting: 'true'});
disableAdvertisingIdentifier
disableAdvertisingIdentifier(shouldDisdable): void
Disables collection of various Advertising IDs by the SDK.
Anroid: Google Advertising ID (GAID), OAID and Amazon Advertising ID (AAID)
iOS: Apple's advertisingIdentifier (IDFA)
parameter | type | description |
---|---|---|
shouldDisdable | Booleano | Flag that disable/enable Advertising ID collection |
Exemplo:
appsFlyer.disableAdvertisingIdentifier(true);
enableTCFDataCollection
enableTCFDataCollection(enabled): void
instruct the SDK to collect the TCF data from the device.
parameter | type | description |
---|---|---|
enabled | Booleano | enable/disable TCF data collection |
Exemplo:
appsFlyer.enableTCFDataCollection(true);
setConsentData
setConsentData(consentObject): void
When GDPR applies to the user and your app does not use a CMP compatible with TCF v2.2, use this API to provide the consent data directly to the SDK.
The AppsFlyerConsent object has 2 methods:
AppsFlyerConsent.forNonGDPRUser
: Indicates that GDPR doesn’t apply to the user and generates nonGDPR consent object. This method doesn’t accept any parameters.AppsFlyerConsent.forGDPRUser
: create an AppsFlyerConsent object with 2 parameters:
parameter | type | description |
---|---|---|
hasConsentForDataUsage | Booleano | Indicates whether the user has consented to use their data for advertising purposes |
hasConsentForAdsPersonalization | Booleano | Indicates whether the user has consented to use their data for personalized advertising |
Exemplo:
import appsFlyer, {AppsFlyerConsent} from 'react-native-appsflyer';
let nonGDPRUser = AppsFlyerConsent.forNonGDPRUser();
// OR
let GDPRUser = AppsFlyerConsent.forGDPRUser(true, false);
appsFlyer.setConsentData(nonGDPRUser /**or**/ GDPRUser);
logAdRevenue
logAdRevenue(data: AFAdRevenueData): void
Use this method to log your ad revenue.
By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.
Param | Tipo |
---|---|
data | AFAdRevenueData |
Exemplo:
const adRevenueData = {
monetizationNetwork: 'AF-AdNetwork',
mediationNetwork: MEDIATION_NETWORK.IRONSOURCE,
currencyIso4217Code: 'USD',
revenue: 1.23,
additionalParameters: {
customParam1: 'value1',
customParam2: 'value2',
}
};
appsFlyer.logAdRevenue(adRevenueData);
Here's how you use appsFlyer.logAdRevenue
within a React Native app:
- Prepare the
adRevenueData
object as shown, including any additional parameters you wish to track along with the ad revenue event. - Chame a API
appsFlyer.logAdRevenue
method with theadRevenueData
object.
By passing all the required fields in AFAdRevenueData
, you help ensure accurate tracking within the AppsFlyer platform. This enables you to analyze your ad revenue alongside other user acquisition data to optimize your app's overall monetization strategy.
Note: The additionalParameters
object is optional. You can add any additional data you want to log with the ad revenue event in this object. This can be useful for detailed analytics or specific event tracking later on. Make sure that the custom parameters follow the data types and structures specified by AppsFlyer in their documentation.
APIs somente para Android
setCollectAndroidID
setCollectAndroidID(isCollect, callback)
Opt-out of collection of Android ID.
If the app does NOT contain Google Play Services, Android ID is collected by the SDK.
However, apps with Google play services should avoid Android ID collection as this is in violation of the Google Play policy.
parameter | type | description |
---|---|---|
isCollect | Booleano | opt-in booleano |
callback | function | success callback |
Exemplo:
if (Platform.OS == 'android') {
appsFlyer.setCollectAndroidID(true, (res) => {
//...
});
}
setCollectIMEI
setCollectIMEI(isCollect, callback)
Opt-out of collection of IMEI.
If the app does NOT contain Google Play Services, device IMEI is collected by the SDK.
However, apps with Google play services should avoid IMEI collection as this is in violation of the Google Play policy.
parameter | type | description |
---|---|---|
isCollect | Booleano | opt-in booleano |
callback | function | success callback |
Exemplo:
if (Platform.OS == 'android') {
appsFlyer.setCollectIMEI(false, (res) => {
//...
});
}
setDisableNetworkData setDisableNetworkData(disable)
setDisableNetworkData(disable)
Use para optar por não participar de coletar o nome do operador de rede (transportadora) e o nome do operador sim do dispositivo.
parameter | type | description |
---|---|---|
desativar | Booleano | O padrão é falso. |
Exemplo:
if (Platform.OS == 'android') {
appsFlyer.setDisableNetworkData(true);
}
performOnDeepLinking
performOnDeepLinking()
Permite gatilho manual da resolução de deep link. Este método permite que os aplicativos que estão atrasando a chamada para appsFlyer.startSdk()
para resolver deep links antes do início do SDK.
Observação:
Esta API acionará o callback appsFlyer.onDeepLink
. No exemplo a seguir, verificamos se res.deepLinkStatus
é igual a “ENCONTRADO” dentro do callback appsFlyer.onDeepLink
para extrair os parâmetros do deeplink.
Exemplo:
// Let's say we want the resolve a deeplink and get the deeplink params when the user clicks on it but delay the actual 'start' of the sdk (not sending launch to appsflyer).
const option = {
isDebug: true,
devKey: 'UsxXxXxed',
appId: '75xXxXxXxXx11',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
manualStart: true, // <--- for manual start.
};
const onDeepLink = appsFlyer.onDeepLink(res => {
if (res.deepLinkStatus == 'FOUND') {
// here we will get the deeplink params after resolving it.
// more flow...
}
});
appsFlyer.initSdk(
option,
() => {
if (!option.manualStart) {
console.warn('AppsFlyer SDK started!');
} else {
console.warn('AppsFlyer SDK init, didn\'t send launch yet');
}
},
() => {},
);
if (Platform.OS == 'android') {
appsFlyer.performOnDeepLinking();
}
// more app flow...
appsFlyer.startSdk(); // <--- Here we send launch
APIs somente para iOS
disableCollectASA
disableCollectASA(shouldDisable)
Desativa a coleta do Apple Search Ads
parameter | type | description |
---|---|---|
shouldDisable | Booleano | Sinalize para desativar/ativar a coleta de dados do Apple Search Ads |
Exemplo:
if (Platform.OS == 'ios') {
appsFlyer.disableCollectASA(true);
}
disableIDFVCollection
disableIDFVCollection(shouldDisable)
Desativa a coleta do identificador do fornecedor do aplicativo (IDFV) no iOS.
O padrão é falso (o SDK coletará o IDFV).
parameter | type | description |
---|---|---|
shouldDisable | Booleano | Sinalizador para desabilitar/habilitar a coleta de IDFV |
Exemplo:
if (Platform.OS == 'ios') {
appsFlyer.disableIDFVCollection(true);
}
setUseReceiptValidationSandbox
void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox)
Validação de recibo de compra em aplicativo Ambiente Apple (produção ou sandbox). O valor padrão é false.
parameter | type | description |
---|---|---|
setUseReceiptValidationSandbox | Booleano | verdadeiro se a compra no aplicativo for feita com sandbox |
Exemplo:
appsFlyer.setUseReceiptValidationSandbox(true);
disableSKAD
disableSKAD(disableSkad)
❗Importante❗ disableSKAD
deve ser chamado antes de chamar initSDK
e SOMENTE para iOS!
parameter | type | description |
---|---|---|
disableSkad | Booleano | verdadeiro se você deseja desabilitar o SKADNetwork |
Exemplo:
if (Platform.OS == 'ios') {
appsFlyer.disableSKAD(true);
}
setCurrentDeviceLanguage
setCurrentDeviceLanguage(language)
Defina o idioma do dispositivo. Os dados serão exibidos em relatórios de dados brutos
Se você deseja limpar esta propriedade, defina uma sequência de caracteres vazia. ("")
parameter | type | description |
---|---|---|
language | string | idioma do dispositivo |
Exemplo:
if (Platform.OS == 'ios') {
appsFlyer.setCurrentDeviceLanguage("EN");
}
AppsFlyerConversionData
onInstallConversionData
onInstallConversionData(callback) : function:unregister
Acessando dados de atribuição/conversão da AppsFlyer a partir do SDK (Deferred Deeplinking).
A implementação do código para o listener de conversão deve ser feita antes do código de inicialização do SDK.
parameter | type | description |
---|---|---|
callback | function | resultado de dados de conversão |
Exemplo:
const onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
(res) => {
if (JSON.parse(res.data.is_first_launch) == true) {
if (res.data.af_status === 'Non-organic') {
var media_source = res.data.media_source;
var campaign = res.data.campaign;
alert('This is first launch and a Non-Organic install. Media source: ' + media_source + ' Campaign: ' + campaign);
} else if (res.data.af_status === 'Organic') {
alert('This is first launch and a Organic Install');
}
} else {
alert('This is not first launch');
}
}
);
appsFlyer.initSdk(/*...*/);
Exemplo onInstallConversionData:
{
"data": {
"af_message": "organic install",
"af_status": "Organic",
"is_first_launch": "true"
},
"status": "success",
"type": "onInstallConversionDataLoaded"
}
Note** is_first_launch will be "true" (string) on Android and true (boolean) on iOS. To solve this issue wrap is_first_launch with JSON.parse(res.data.is_first_launch) as in the example above.
appsFlyer.onInstallConversionData
retorna uma função que nos permitirá chamar NativeAppEventEmitter.remove()
.
onInstallConversionFailure
onInstallConversionFailure(callback) : function:unregister
parameter | type | description |
---|---|---|
callback | function | Resultado de dados de conversão com falha |
Exemplo:
const onInstallGCDFailure = appsFlyer.onInstallConversionFailure(res => {
console.log(JSON.stringify(res, null, 2));
});
Exemplo de onInstallConversionFailure:
{
"status": "failure",
"type": "onInstallConversionFailure",
"data": "DevKey is incorrect"
}
onAppOpenAttribution
onAppOpenAttribution(callback) : function:unregister
This API is related to DeepLinks. Please read more here
parameter | type | description |
---|---|---|
callback | function | Resultado de dados onAppOpenAttribution |
Exemplo:
const onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => {
console.log(res);
});
appsFlyer.initSdk(/*...*/);
onAttributionFailure
onAttributionFailure(callback) : function:unregister
This API is related to DeepLinks. Please read more here
parameter | type | description |
---|---|---|
callback | function | Erro de dados onAppOpenAttribution |
Exemplo:
const onAppOpenAttributionCanceller = appsFlyer.onAttributionFailure((res) => {
console.log(res);
});
appsFlyer.initSdk(/*...*/);
onDeepLink
onDeepLink(callback) : function:unregister
This API is related to DeepLinks. Please read more here
parameter | type | description |
---|---|---|
callback | function | Erro de dados UDL |
Exemplo:
const onDeepLinkCanceller = appsFlyer.onDeepLink(res => {
if (res?.deepLinkStatus !== 'NOT_FOUND') {
const DLValue = res?.data.deep_link_value;
const mediaSrc = res?.data.media_source;
const param1 = res?.data.af_sub1;
console.log(JSON.stringify(res?.data, null, 2));
}
})
appsFlyer.initSdk(/*...*/);
Atualizado 11 dias atrás