Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### Version 4.29.0 (15th July 2021)
#### Added
- [beta] Added data residency feature. You can choose this setting by calling `setUrlStrategy` method of `AdjustConfig` instance with `AdjustConfig.DataResidencyEU` (for EU data residency region), `AdjustConfig.DataResidencyTR` (for TR data residency region) or `AdjustConfig.DataResidencyUS` value (for US data residency region).
- Added possibility to `trackAdRevenue` method of `Adjust` interface to allow tracking of ad revenue by passing `AdjustAdRevenue` object as parameter.
- Added support for `AppLovin MAX` ad revenue tracking.
- Added `setConversionValueUpdatedCallbackListener` method to `AdjustConfig` which can be used to set a callback which will get information when Adjust SDK updates conversion value for the user.
- Added preinstall tracking with usage of system installer receiver on Android platform (`setPreinstallFilePath` method of the `AdjustConfig`).

#### Native SDKs
- [[email protected]][ios_sdk_v4.29.3]
- [[email protected]][android_sdk_v4.28.2]

---

### Version 4.28.0 (1th April 2021)
#### Changed
- Removed native iOS legacy code.
Expand Down Expand Up @@ -411,6 +425,7 @@
[ios_sdk_v4.23.2]: https://github.com/adjust/ios_sdk/tree/v4.23.2
[ios_sdk_v4.26.1]: https://github.com/adjust/ios_sdk/tree/v4.26.1
[ios_sdk_v4.28.0]: https://github.com/adjust/ios_sdk/tree/v4.28.0
[ios_sdk_v4.29.3]: https://github.com/adjust/ios_sdk/tree/v4.29.3

[android_sdk_v4.10.4]: https://github.com/adjust/android_sdk/tree/v4.10.4
[android_sdk_v4.11.0]: https://github.com/adjust/android_sdk/tree/v4.11.0
Expand All @@ -435,3 +450,4 @@
[android_sdk_v4.24.1]: https://github.com/adjust/android_sdk/tree/v4.24.1
[android_sdk_v4.26.2]: https://github.com/adjust/android_sdk/tree/v4.26.2
[android_sdk_v4.27.0]: https://github.com/adjust/android_sdk/tree/v4.27.0
[android_sdk_v4.28.2]: https://github.com/adjust/android_sdk/tree/v4.28.2
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This is the React Native SDK of Adjust™. You can read more about Adjust™ at
* [Get current authorisation status](#ata-getter)
* [SKAdNetwork framework](#skadn-framework)
* [Update SKAdNetwork conversion value](#skadn-update-conversion-value)
* [Conversion value updated callback](#skadn-cv-updated-callback)
* [Event tracking](#event-tracking)
* [Revenue tracking](#revenue-tracking)
* [Revenue deduplication](#revenue-deduplication)
Expand Down Expand Up @@ -53,13 +54,15 @@ This is the React Native SDK of Adjust™. You can read more about Adjust™ at
* [Google Play Services advertising identifier](#di-gps-adid)
* [Amazon advertising identifier](#di-fire-adid)
* [Adjust device identifier](#di-adid)
* [Set external device ID](#set-external-device-id)
* [Push token](#push-token)
* [Track additional device identifiers](#track-additional-ids)
* [Pre-installed trackers](#pre-installed-trackers)
* [Deep linking](#deeplinking)
* [Standard deep linking](#deeplinking-standard)
* [Deferred deep linking](#deeplinking-deferred)
* [Reattribution via deep links](#deeplinking-reattribution)
* [[beta] Data residency](#data-residency)
* [License](#license)

## <a id="example-app"></a>Example app
Expand Down Expand Up @@ -342,6 +345,23 @@ You can use Adjust SDK wrapper method `updateConversionValue` to update SKAdNetw
Adjust.updateConversionValue(6);
```

### <a id="af-skadn-cv-updated-callback"></a>Conversion value updated callback

**Note**: This feature exists only in iOS platform.

You can register callback to get notified each time when Adjust SDK updates conversion value for the user.

```js
var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setConversionValueUpdatedCallbackListener(function(conversionValue) {
console.log("Conversion value updated callback recveived");
console.log("Conversion value: " + conversionValue.conversionValue);
});

Adjust.create(adjustConfig);
```

### <a id="event-tracking"></a>Event tracking

You can use Adjust to track all kinds of events. Let's say you want to track every tap on a button. Simply create a new event token in your [dashboard]. Let's say that event token is `abc123`. You can add the following line in your button’s click handler method to track the click:
Expand Down Expand Up @@ -911,6 +931,30 @@ Adjust.getAdid((adid) => {

**Note**: Information about the **adid** is only available after an app installation has been tracked by the Adjust backend. From that moment on, the Adjust SDK has information about the device **adid** and you can access it with this method. So, **it is not possible** to access the **adid** value before the SDK has been initialized and installation of your app has been successfully tracked.

### <a id="set-external-device-id"></a>Set external device ID

> **Note** If you want to use external device IDs, please contact your Adjust representative. They will talk you through the best approach for your use case.

An external device identifier is a custom value that you can assign to a device or user. They can help you to recognize users across sessions and platforms. They can also help you to deduplicate installs by user so that a user isn't counted as multiple new installs.

You can also use an external device ID as a custom identifier for a device. This can be useful if you use these identifiers elsewhere and want to keep continuity.

Check out our [external device identifiers article](https://help.adjust.com/en/article/external-device-identifiers) for more information.

> **Note** This setting requires Adjust SDK v4.21.0 or later.

To set an external device ID, assign the identifier to the `externalDeviceId` property of your config instance. Do this before you initialize the Adjust SDK.

```js
adjustConfig.setExternalDeviceId("{Your-External-Device-Id}");
```

> **Important**: You need to make sure this ID is **unique to the user or device** depending on your use-case. Using the same ID across different users or devices could lead to duplicated data. Talk to your Adjust representative for more information.

If you want to use the external device ID in your business analytics, you can pass it as a session callback parameter. See the section on [session callback parameters](#session-callback-parameters) for more information.

You can import existing external device IDs into Adjust. This ensures that the backend matches future data to your existing device records. If you want to do this, please contact your Adjust representative.

### <a id="user-attribution"></a>User attribution

This callback is triggered as described in the [attribution callback section](#attribution-callback), providing you with information about a new attribution whenever it changes. If you want to access information about a user's current attribution status at any other time, you can make a call to the `getAttribution` method of the `Adjust` instance and pass your callback as a parameter to which the attribution value will be sent once obtained:
Expand Down Expand Up @@ -1060,6 +1104,18 @@ handleDeepLink(event) {
}
```

### <a id="data-residency"></a>[beta] Data residency

In order to enable data residency feature, make sure to call `setUrlStrategy` method of the `AdjustConfig` instance with one of the following constants:

```js
adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyEU); // for EU data residency region
adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyTR); // for Turkey data residency region
adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyUS); // for US data residency region
```

**Note:** This feature is currently in beta testing phase. If you are interested in getting access to it, please contact your dedicated account manager or write an email to [email protected]. Please, do not turn this setting on before making sure with the support team that this feature is enabled for your app because otherwise SDK traffic will get dropped.

[dashboard]: http://adjust.com
[adjust.com]: http://adjust.com

Expand Down Expand Up @@ -1090,7 +1146,7 @@ handleDeepLink(event) {

The Adjust SDK is licensed under the MIT License.

Copyright (c) 2012-2018 Adjust GmbH, http://www.adjust.com
Copyright (c) 2012-2021 Adjust GmbH, http://www.adjust.com

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.28.0
4.29.0
Binary file modified android/libs/adjust-android.jar
Binary file not shown.
102 changes: 101 additions & 1 deletion android/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Adjust SDK
//
// Created by Abdullah Obaied (@Obaied) on 19th October 2016.
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
// Copyright (c) 2016-2021 Adjust GmbH. All rights reserved.
//

package com.adjust.nativemodule;
Expand Down Expand Up @@ -110,6 +110,7 @@ public void create(ReadableMap mapConfig) {
String defaultTracker = null;
String externalDeviceId = null;
String urlStrategy = null;
String preinstallFilePath = null;
long secretId = 0L;
long info1 = 0L;
long info2 = 0L;
Expand Down Expand Up @@ -207,6 +208,12 @@ public void create(ReadableMap mapConfig) {
adjustConfig.setUrlStrategy(AdjustConfig.URL_STRATEGY_CHINA);
} else if (urlStrategy.equalsIgnoreCase("india")) {
adjustConfig.setUrlStrategy(AdjustConfig.URL_STRATEGY_INDIA);
} else if (urlStrategy.equalsIgnoreCase("data-residency-eu")) {
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_EU);
} else if (urlStrategy.equalsIgnoreCase("data-residency-us")) {
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_US);
} else if (urlStrategy.equalsIgnoreCase("data-residency-tr")) {
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_TR);
}
}

Expand All @@ -216,6 +223,11 @@ public void create(ReadableMap mapConfig) {
adjustConfig.setUserAgent(userAgent);
}

if (checkKey(mapConfig, "preinstallFilePath")) {
preinstallFilePath = mapConfig.getString("preinstallFilePath");
adjustConfig.setPreinstallFilePath(preinstallFilePath);
}

// App secret.
if (checkKey(mapConfig, "secretId")
&& checkKey(mapConfig, "info1")
Expand Down Expand Up @@ -429,6 +441,94 @@ public void trackAdRevenue(String source, String payload) {
}
}

@ReactMethod
public void trackAdRevenueNew(ReadableMap mapAdRevenue) {
if (mapAdRevenue == null) {
return;
}

double revenue = -1.0;
int adImpressionsCount = -1;
String source = null;
String currency = null;
String adRevenueNetwork = null;
String adRevenueUnit = null;
String adRevenuePlacement = null;
Map<String, Object> callbackParameters = null;
Map<String, Object> partnerParameters = null;

// Source.
if (checkKey(mapAdRevenue, "source")) {
source = mapAdRevenue.getString("source");
}

final AdjustAdRevenue adRevenue = new AdjustAdRevenue(source);

// Revenue.
if (checkKey(mapAdRevenue, "revenue") || checkKey(mapAdRevenue, "currency")) {
try {
revenue = Double.parseDouble(mapAdRevenue.getString("revenue"));
} catch (NumberFormatException ignore) {}
currency = mapAdRevenue.getString("currency");
adRevenue.setRevenue(revenue, currency);
}

// Ad impressions count.
if (checkKey(mapAdRevenue, "adImpressionsCount")) {
try {
adImpressionsCount = Integer.parseInt(mapAdRevenue.getString("adImpressionsCount"));
} catch (NumberFormatException ignore) {}
adRevenue.setAdImpressionsCount(adImpressionsCount);
}

// Ad revenue network.
if (checkKey(mapAdRevenue, "adRevenueNetwork")) {
adRevenueNetwork = mapAdRevenue.getString("adRevenueNetwork");
if (null != adRevenueNetwork) {
adRevenue.setAdRevenueNetwork(adRevenueNetwork);
}
}

// Ad revenue unit.
if (checkKey(mapAdRevenue, "adRevenueUnit")) {
adRevenueUnit = mapAdRevenue.getString("adRevenueUnit");
if (null != adRevenueUnit) {
adRevenue.setAdRevenueUnit(adRevenueUnit);
}
}

// Ad revenue placement.
if (checkKey(mapAdRevenue, "adRevenuePlacement")) {
adRevenuePlacement = mapAdRevenue.getString("adRevenuePlacement");
if (null != adRevenuePlacement) {
adRevenue.setAdRevenuePlacement(adRevenuePlacement);
}
}

// Callback parameters.
if (checkKey(mapAdRevenue, "callbackParameters")) {
callbackParameters = AdjustUtil.toMap(mapAdRevenue.getMap("callbackParameters"));
if (null != callbackParameters) {
for (Map.Entry<String, Object> entry : callbackParameters.entrySet()) {
adRevenue.addCallbackParameter(entry.getKey(), entry.getValue().toString());
}
}
}

// Partner parameters.
if (checkKey(mapAdRevenue, "partnerParameters")) {
partnerParameters = AdjustUtil.toMap(mapAdRevenue.getMap("partnerParameters"));
if (null != partnerParameters) {
for (Map.Entry<String, Object> entry : partnerParameters.entrySet()) {
adRevenue.addPartnerParameter(entry.getKey(), entry.getValue().toString());
}
}
}

// Track ad revenue.
com.adjust.sdk.Adjust.trackAdRevenue(adRevenue);
}

@ReactMethod
public void trackPlayStoreSubscription(ReadableMap mapEvent) {
if (mapEvent == null) {
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/adjust/sdk/AdjustPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Adjust SDK
//
// Created by Abdullah Obaied (@Obaied) on 19th October 2016.
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
// Copyright (c) 2016-2021 Adjust GmbH. All rights reserved.
//

package com.adjust.nativemodule;
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/adjust/sdk/AdjustUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Adjust SDK
//
// Created by Abdullah Obaied (@Obaied) on 19th October 2016.
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
// Copyright (c) 2016-2021 Adjust GmbH. All rights reserved.
//

package com.adjust.nativemodule;
Expand Down
10 changes: 9 additions & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Text,
StatusBar,
TouchableHighlight,
Platform,
} from 'react-native';
import {
Header,
Expand Down Expand Up @@ -102,6 +103,11 @@ const App: () => React$Node = () => {
console.log("URL: " + uri.uri);
});

adjustConfig.setConversionValueUpdatedCallbackListener(function(conversionValue) {
console.log("Conversion value updated callback recveived");
console.log("Conversion value: " + conversionValue.conversionValue);
});

Adjust.addSessionCallbackParameter("scpk1", "scpv1");
Adjust.addSessionCallbackParameter("scpk2", "scpv2");

Expand Down Expand Up @@ -136,7 +142,9 @@ const App: () => React$Node = () => {
}
});

AdjustOaid.readOaid();
if (Platform.OS === "android") {
AdjustOaid.readOaid();
}
Adjust.create(adjustConfig);

function componentDidMount() {
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import com.android.build.OutputFile
*/

project.ext.react = [
enableHermes: false
enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
]

apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.example;
package com.adjust.examples;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand Down
21 changes: 2 additions & 19 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.adjust.examples">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="40.0.0"/>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="42.0.0"/>
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
Expand Down
Loading