Skip to content

Commit e7d4dc6

Browse files
committed
Added documentation
1 parent 9f90c8e commit e7d4dc6

File tree

1 file changed

+95
-6
lines changed

1 file changed

+95
-6
lines changed

doc/API.md

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Types
66
- [AppsFlyerOptions](#appsflyer-options)
7+
- [AdRevenueData](#AdRevenueData)
8+
- [AFMediationNetwork](#AFMediationNetwork)
79

810
## Methods
911
- [initSdk](#initSdk)
@@ -52,11 +54,12 @@
5254
- [getOutOfStore](#getOutOfStore)
5355
- [setDisableNetworkData](#setDisableNetworkData)
5456
- [performOnDeepLinking](#performondeeplinking)
57+
- [logAdRevenue](#logAdRevenue) - Since 6.15.1
5558

5659

5760
---
5861

59-
##### <a id="appsflyer-options"> **`AppsflyerSdk(Map options)`**
62+
##### <a id="appsflyer-options"> **`AppsflyerSdk(Map options)`**
6063

6164
| parameter | type | description |
6265
| --------- | ----- | ----------------- |
@@ -116,6 +119,42 @@ Once `AppsflyerSdk` object is created, you can call `initSdk` method.
116119

117120
---
118121

122+
##### <a id="AdRevenueData"> **`AdRevenueData`**
123+
124+
| parameter | type | description |
125+
| --------- | ------------------ | ----------------- |
126+
| `monetizationNetwork` | `String` | |
127+
| `mediationNetwork` | `String` | value must be taken from `AFMediationNetwork` |
128+
| `currencyIso4217Code` | `String` | |
129+
| `revenue` | `double` | |
130+
| `additionalParameters` | `Map<String, dynamic>?` | |
131+
132+
---
133+
134+
##### <a id="AFMediationNetwork"> **`AFMediationNetwork`**
135+
an enumeration that includes the supported mediation networks by AppsFlyer.
136+
137+
138+
| networks |
139+
| -------- |
140+
| ironSource
141+
applovinMax
142+
googleAdMob
143+
fyber
144+
appodeal
145+
admost
146+
topon
147+
tradplus
148+
yandex
149+
chartboost
150+
unity
151+
toponPte
152+
customMediation
153+
directMonetizationNetwork |
154+
155+
---
156+
157+
119158
##### <a id="initSdk"> **`initSdk({bool registerConversionDataCallback, bool registerOnAppOpenAttributionCallback}) async` (Changed in 1.2.2)**
120159

121160
initialize the SDK, using the options initialized from the constructor|
@@ -561,7 +600,7 @@ This call matches the following payload structure:
561600

562601
1. First define the Onelink ID (find it in the AppsFlyer dashboard in the onelink section:
563602

564-
**`Future<void> setAppInviteOneLinkID(String oneLinkID, Function callback)`**
603+
**`Future<void> setAppInviteOneLinkID(String oneLinkID, Function callback)`**
565604

566605
2. Set the AppsFlyerInviteLinkParams class to set the query params in the user invite link:
567606

@@ -579,7 +618,7 @@ class AppsFlyerInviteLinkParams {
579618

580619
3. Call the generateInviteLink API to generate the user invite link. Use the success and error callbacks for handling.
581620

582-
**`void generateInviteLink(AppsFlyerInviteLinkParams parameters, Function success, Function error)`**
621+
**`void generateInviteLink(AppsFlyerInviteLinkParams parameters, Function success, Function error)`**
583622

584623

585624
_Example:_
@@ -653,7 +692,7 @@ appsFlyerSdk.setCurrentDeviceLanguage("en");
653692
---
654693
**<a id="setSharingFilterForPartners"> `void setSharingFilterForPartners(List<String> partners)`**
655694

656-
`setSharingFilter` & `setSharingFilterForAllPartners` APIs were deprecated!
695+
`setSharingFilter` & `setSharingFilterForAllPartners` APIs were deprecated!
657696

658697
Use `setSharingFilterForPartners` instead.
659698

@@ -672,9 +711,9 @@ appsFlyerSdk.setSharingFilterForPartners(['googleadwords_int', 'all']);
672711
---
673712
**<a id="setOneLinkCustomDomain"> `void setOneLinkCustomDomain(List<String> brandDomains)`**
674713

675-
Use this API in order to set branded domains.
714+
Use this API in order to set branded domains.
676715

677-
Find more information in the [following article on branded domains](https://support.appsflyer.com/hc/en-us/articles/360002329137-Implementing-Branded-Links).
716+
Find more information in the [following article on branded domains](https://support.appsflyer.com/hc/en-us/articles/360002329137-Implementing-Branded-Links).
678717

679718
_Example:_
680719
```dart
@@ -823,3 +862,53 @@ Note:<br>This API will trigger the `appsflyerSdk.onDeepLink` callback. In the fo
823862
_appsflyerSdk.startSDK();
824863
}
825864
```
865+
866+
---
867+
868+
### **<a id="logAdRevenue"> `void logAdRevenue(AdRevenueData adRevenueData)`**
869+
870+
The logAdRevenue API is designed to simplify the process of logging ad revenue events to AppsFlyer from your Flutter application. This API tracks revenue generated from advertisements, enriching your monetization analytics. Below you will find instructions on how to use this API correctly, along with detailed descriptions and examples for various input scenarios.
871+
872+
### **Usage:**
873+
To use the logAdRevenue method, you must:
874+
875+
1. Prepare an instance of `AdRevenueData` with the required information about the ad revenue event.
876+
1. Call `logAdRevenue` with the `AdRevenueData` instance.
877+
878+
**AdRevenueData Class**
879+
[AdRevenueData](#AdRevenueData) is a data class representing all the relevant information about an ad revenue event:
880+
881+
* `monetizationNetwork`: The source network from which the revenue was generated (e.g., AdMob, Unity Ads).
882+
* `mediationNetwork`: The mediation platform managing the ad (use AFMediationNetwork enum for supported networks).
883+
* `currencyIso4217Code`: The ISO 4217 currency code representing the currency of the revenue amount (e.g., "USD", "EUR").
884+
* `revenue`: The amount of revenue generated from the ad.
885+
* `additionalParameters`: Additional parameters related to the ad revenue event (optional).
886+
887+
888+
**AFMediationNetwork Enum**
889+
[AFMediationNetwork](#AFMediationNetwork) is an enumeration that includes the supported mediation networks by AppsFlyer. It's important to use this enum to ensure you provide a valid network identifier to the logAdRevenue API.
890+
891+
### Example:
892+
```dart
893+
// Instantiate AdRevenueData with the ad revenue details.
894+
AdRevenueData adRevenueData = AdRevenueData(
895+
monetizationNetwork: "GoogleAdMob", // Replace with your actual monetization network.
896+
mediationNetwork: AFMediationNetwork.applovinMax.value, // Use the value from the enum.
897+
currencyIso4217Code: "USD",
898+
revenue: 1.23,
899+
additionalParameters: {
900+
// Optional additional parameters can be added here. This is an example, can be discard if not needed.
901+
'adUnitId': 'ca-app-pub-XXXX/YYYY',
902+
'ad_network_click_id': '12345'
903+
}
904+
);
905+
906+
// Log the ad revenue event.
907+
logAdRevenue(adRevenueData);
908+
```
909+
910+
**Additional Points**
911+
* Mediation network input must be from the provided [AFMediationNetwork](#AFMediationNetwork)
912+
enum to ensure proper processing by AppsFlyer. For instance, use `AFMediationNetwork.googleAdMob.value` to denote Google AdMob as the Mediation Network.
913+
* The `additionalParameters` map is optional. Use it to pass any extra information you have regarding the ad revenue event; this information could be useful for more refined analytics.
914+
* Make sure the `currencyIso4217Code` adheres to the appropriate standard. Misconfigured currency code may result in incorrect revenue tracking.

0 commit comments

Comments
 (0)