Skip to content

Commit

Permalink
Merge pull request #259 from AppsFlyerSDK/releases/6.x.x/6.15.x/6.15.…
Browse files Browse the repository at this point in the history
…1-rc4

Releases/6.x.x/6.15.x/6.15.1 rc4
  • Loading branch information
noa-kogonia committed Sep 2, 2024
2 parents 5167dd3 + af330b1 commit 3f55615
Show file tree
Hide file tree
Showing 12 changed files with 295 additions and 11 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ For lower versions of cordova-android please use plugin version 4.3.3 available
- From version **6.1.10** the plugin uses cocoapods(NOT StaticLib) in order to support iOS app-kids Strict mode. <br>
You can read more [here](https://support.appsflyer.com/hc/en-us/articles/207032066#integration-strict-mode-sdk)
- From version **6.10.2** the plugin requires using the implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.20' in Android.
- From version **6.14.3** the plugin requires Target version 12 and higher in iOS.
- From version **6.15.1** the plugin requires adding the value '/usr/lib/swift' to Build Settings 'RunPath Search Paths' key in iOS.
----------


Expand All @@ -42,8 +44,13 @@ You can read more [here](https://support.appsflyer.com/hc/en-us/articles/2070320

### <a id="plugin-build-for"> This plugin is built for

- iOS AppsFlyerSDK **v6.14.3**
- Android AppsFlyerSDK **v6.14.0**
- iOS AppsFlyerSDK **v6.15.1**
- Android AppsFlyerSDK **v6.15.0**

### <a id="breakingChanges"> ❗v6.15.1 Breaking Changes

iOS platform:
The plugin requires adding the value '/usr/lib/swift' to Build Settings 'RunPath Search Paths' key in iOS, Otherwise there might be some compilation errors.

### <a id="breakingChanges"> ❗v6.14.3 Breaking Changes

Expand Down
10 changes: 10 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 6.15.1
Release date: *2024-09-02*

- Cordova >> Update Plugin to v6.15.1

## 6.15.1
Release date: *2024-09-02*

- Cordova >> Update Plugin to v6.15.1

## 6.14.3
Release date: *2024-04-30*

Expand Down
44 changes: 43 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ The list of available methods for this plugin is described below.
| [`sendPushNotificationData`](#sendPushNotificationData) | `(Object data)` | Measure and get data from push-notification campaigns. |
| [`setDisableNetworkData`](#setDisableNetworkData) | `(boolean disable)` | Use to opt-out of collecting the network operator name (carrier) and sim operator name from the device. |
| [`setConsentData`](#setConsentData) | `(boolean disable)` | Use to manually collecting the consent data from the user. |
| [`enableTCFDataCollection`](#enableTCFDataCollection) | `(boolean enable)` | instruct the SDK to collect the TCF data from the device. |
| [`enableTCFDataCollection`](#enableTCFDataCollection) | `(boolean enable)` | instruct the SDK to collect the TCF data from the device. |
| [`logAdRevenue`](#logAdRevenue) | `(Object adRevenueData, Object additionalParams)` | Log ad revenue event. |


---
Expand Down Expand Up @@ -799,6 +800,47 @@ window.plugins.appsFlyer.enableTCFDataCollection(true);
```

---

##### <a id="logAdRevenue"> **`logAdRevenue(adRevenueData, additionalParams): void`**
log ad-revenue event.

| parameter | type | description |
|------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `adRevenueData` | `Object` | the object must contain the following fields:<br/>monetizationNetwork: String testMonetizationNetwork<br/> mediationNetwork: MediationNetwork testMediationNetwork<br/>currencyIso4217Code: String currencyByIso4217CodeFormat <br/>revenue:double revenue |
| `additionalData` | `Object` | additional Params Data map, @Nullable |


*Example:*

```javascript

let mediationNetwork = MediationNetwork.TOPON;
let adRevenueData = {
'monetizationNetwork': 'testMonetizationNetwork',
'mediationNetwork': mediationNetwork,
'currencyIso4217Code': 'USD',
'revenue': 15.0
};
let additionalParams = {
'additionalKey1':'additionalValue1',
'additionalKey2':'additionalValue2'
}
window.plugins.appsFlyer.logAdRevenue(adRevenueData, additionalParams);


```
Here's how you use `appsFlyer.logAdRevenue` within a Cordova app:

1. Prepare the `adRevenueData` object as shown, including any additional parameters you wish to track along with the ad revenue event.
2. Call the `appsFlyer.logAdRevenue` method with the `adRevenueData` 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.
---


### <a id="deep-linking-tracking"> Deep linking Tracking


Expand Down
54 changes: 53 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,104 @@
{

"name": "cordova-plugin-appsflyer-sdk",
"version": "6.14.3",

"version": "6.15.1",

"description": "Cordova AppsFlyer SDK Plugin",

"cordova": {

"id": "cordova-plugin-appsflyer-sdk",

"platforms": [

"android",

"ios"

]

},

"repository": {

"type": "git",

"url": "git+https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk.git"

},

"keywords": [

"cordova",

"appsflyer",

"ecosystem:cordova",

"cordova-android",

"cordova-ios"

],

"engines": [

{

"name": "cordova",

"version": ">=4.3.0"

}

],

"author": "Appsflyer",

"license": {

"type": "MIT",

"url": "https://github.com/AppsFlyerSDK/appsflyer-cordova-plugin/blob/master/LICENSE"

},

"bugs": {

"url": "https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk/issues"

},

"homepage": "https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk#readme",

"scripts": {

"test": "npm run jshint",

"jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests",

"setupIonicCordova": "cd examples/ionic-cordova; npm install; ionic cordova plugin rm cordova-plugin-appsflyer-sdk --save; ionic cordova platform rm android; ionic cordova platform rm ios; ionic cordova plugin add cordova-plugin-appsflyer-sdk --save; ionic cordova platform add android; ionic cordova platform add ios",

"runIonicCordovaIos": "cd examples/ionic-cordova; ionic cordova prepare ios; ionic cordova run ios;",

"runIonicCordovaAndroid": "cd examples/ionic-cordova; ionic cordova prepare android; ionic cordova run android;",

"setupCordova": "cd examples/cordova; npm install; cordova plugin rm cordova-plugin-appsflyer-sdk --save; cordova platform rm android; cordova platform rm ios; cordova plugin add cordova-plugin-appsflyer-sdk --save; cordova platform add android; cordova platform add ios",

"runCordovaIos": "cd examples/cordova; cordova prepare ios; cordova run ios;",

"runCordovaAndroid": "cd examples/cordova; cordova prepare android; cordova run android;"

},

"devDependencies": {

"jshint": "^2.6.0"

},

"dependencies": {}

}

3 changes: 1 addition & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@
<config>
</config>
<pods use-frameworks="true">
<pod name="AppsFlyerFramework" spec="6.14.3"/>
<pod name="AppsFlyerFramework" spec="6.15.1"/>
</pods>
</podspec>
</platform>


</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class AppsFlyerConstants {

final static String PLUGIN_VERSION = "6.14.0";
final static String PLUGIN_VERSION = "6.15.1";
final static String NO_DEVKEY_FOUND = "AppsFlyer 'devKey' is missing or empty";
final static String NO_GCM_PROJECT_NUMBER_PROVIDED = "No GCM Project number provided";
final static String SUCCESS = "Success";
Expand Down
50 changes: 50 additions & 0 deletions src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
import com.appsflyer.internal.platform_extension.Plugin;
import com.appsflyer.internal.platform_extension.PluginInfo;
import com.appsflyer.AppsFlyerConsent;
import com.appsflyer.MediationNetwork;
import com.appsflyer.AFAdRevenueData;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
Expand Down Expand Up @@ -176,10 +178,58 @@ public boolean execute(final String action, JSONArray args, CallbackContext call
return setConsentData(args);
} else if ("enableTCFDataCollection".equals(action)) {
return enableTCFDataCollection(args);
} else if ("logAdRevenue".equals(action)) {
return logAdRevenue(args);
}
return false;
}

/**
* log AdRevenue event
*
* @param args - event params
* @return true
*/
private boolean logAdRevenue(JSONArray args) {
cordova.getThreadPool().execute(() -> {
Map<String, Object> additionalParameters = null;
try {
if(!args.get(0).equals(null)){
JSONObject afAdRevenueDataJsonObj = args.getJSONObject(0);
String monetizationNetwork = afAdRevenueDataJsonObj.optString("monetizationNetwork", null);
String mediationNetwork = afAdRevenueDataJsonObj.optString("mediationNetwork", null);
String currencyIso4217Code = afAdRevenueDataJsonObj.optString("currencyIso4217Code", null);
double revenue = afAdRevenueDataJsonObj.optDouble("revenue", -1);
MediationNetwork mediationNetworkEnumVal = null;

if(mediationNetwork != null){
for(MediationNetwork mediationNetworkEnum: MediationNetwork.values()){
if(mediationNetworkEnum.getValue().equals(mediationNetwork)){
mediationNetworkEnumVal = mediationNetworkEnum;
continue;
}
}
}

if(!args.get(1).equals(null)){
JSONObject additionalParametersJson = args.getJSONObject(1);
additionalParameters = toObjectMap(additionalParametersJson);
}
if(mediationNetworkEnumVal != null){
AFAdRevenueData afAdRevenueData = new AFAdRevenueData(monetizationNetwork, mediationNetworkEnumVal, currencyIso4217Code, revenue);
AppsFlyerLib.getInstance().logAdRevenue(afAdRevenueData, additionalParameters);
}
else{
Log.d("AppsFlyer", "Could not log Ad-Revenue event, bad inputs");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
});
return true;
}

/**
* set consent data according to GDPR if applies or not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/android/cordovaAF.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repositories {

dependencies {
implementation 'com.android.installreferrer:installreferrer:2.1'
implementation 'com.appsflyer:af-android-sdk:6.14.0@aar'
implementation 'com.appsflyer:af-android-sdk:6.15.0@aar'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.20'
}
1 change: 1 addition & 0 deletions src/ios/AppsFlyerPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- (void)setCurrentDeviceLanguage:(CDVInvokedUrlCommand*)command;
- (void)setAdditionalData:(CDVInvokedUrlCommand*)command;
- (void)setConsentData:(CDVInvokedUrlCommand*)command;
- (void)logAdRevenue:(CDVInvokedUrlCommand*)command;
- (void)enableTCFDataCollection:(CDVInvokedUrlCommand*)command;
- (void)setSharingFilter:(CDVInvokedUrlCommand*)command __attribute__((deprecated));
- (void)setSharingFilterForAllPartners:(CDVInvokedUrlCommand*)command __attribute__((deprecated));
Expand Down
Loading

0 comments on commit 3f55615

Please sign in to comment.