Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ad5ec06
Native submodules update
uerceg Apr 10, 2020
47ddc51
Test app IP update
uerceg Apr 10, 2020
7033b8a
New version 4.21.1
uerceg Apr 10, 2020
5b5cc31
Native submodules update
uerceg Apr 16, 2020
c67c3b3
Removing apps again (thank you React Native)
uerceg Apr 16, 2020
ae9844c
Example and test apps rebirth
uerceg Apr 16, 2020
34c3e2e
CHANGELOG.md update
uerceg Apr 16, 2020
9496a4f
Initial implementation of OAID plugin
uerceg Apr 24, 2020
cd27667
Native submodules update
uerceg Apr 24, 2020
3d26d86
Native iOS SDK update to v4.21.3
uerceg Apr 24, 2020
4d024fd
CHANGELOG.md update
uerceg Apr 24, 2020
a268295
CHANGELOG.md update
uerceg May 7, 2020
977590c
Update pod version referencing in podspec file
uerceg May 7, 2020
ebd3cf8
Add docs folder and oaid.md to it
uerceg May 7, 2020
2b971e0
Update .npmignore to exclude docs folder from plugin
uerceg May 7, 2020
ab335a9
Add ads-identifier dependency to example app
uerceg Jun 4, 2020
64c7c48
Native submodules update
uerceg Jun 4, 2020
aa41d66
Adding subscription tracking API to index.js
uerceg Jun 5, 2020
b4d58f7
Native binaries and source files update
uerceg Jun 5, 2020
db7eb09
New version 4.22.0
uerceg Jun 5, 2020
023e17c
Use iOS SDK v4.22.0 Pod
uerceg Jun 5, 2020
681580c
Subscription tracking implementation for iOS and Android + testing
uerceg Jun 5, 2020
9b0f66a
Example app update
uerceg Jun 5, 2020
437b1da
Run platform specific commands only on those platforms
uerceg Jun 5, 2020
c6b1bdb
Run OAID commands only on Android platform
uerceg Jun 5, 2020
a6d1cb9
Add subscription tracking API to index.d.ts
uerceg Jun 5, 2020
16a44bf
CHANGELOG.md update
uerceg Jun 5, 2020
9654f4d
Final tests
uerceg Jun 5, 2020
5dc968d
README update
uerceg Jun 6, 2020
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
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ node_modules
# Adjust SDK
ext/
example/
test/
test/
plugins/
docs/
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### Version 4.22.0 (6th June 2020)
#### Added
- Added subscription tracking feature.
- Added OAID plugin for Adjust SDK named `react-native-adjust-oaid`. With this plugin added next to Adjust SDK, SDK will be able to read Open Advertising ID if present on the device.
- Added support for Huawei App Gallery install referrer.

#### Changed
- Updated communication flow with `iAd.framework`.

#### Native SDKs
- [[email protected]][ios_sdk_v4.22.1]
- [[email protected]][android_sdk_v4.22.0]

---

### Version 4.21.0 (1st April 2020)
#### Added
- Added `disableThirdPartySharing` method to `Adjust` interface to allow disabling of data sharing with third parties outside of Adjust ecosystem.
Expand Down Expand Up @@ -337,6 +352,8 @@
[ios_sdk_v4.18.0]: https://github.com/adjust/ios_sdk/tree/v4.18.0
[ios_sdk_v4.18.3]: https://github.com/adjust/ios_sdk/tree/v4.18.3
[ios_sdk_v4.21.0]: https://github.com/adjust/ios_sdk/tree/v4.21.0
[ios_sdk_v4.21.3]: https://github.com/adjust/ios_sdk/tree/v4.21.3
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1

[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 @@ -355,3 +372,5 @@
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0
[android_sdk_v4.18.3]: https://github.com/adjust/android_sdk/tree/v4.18.3
[android_sdk_v4.21.0]: https://github.com/adjust/android_sdk/tree/v4.21.0
[android_sdk_v4.21.1]: https://github.com/adjust/android_sdk/tree/v4.21.1
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This is the React Native SDK of Adjust™. You can read more about Adjust™ at
* [Callback parameters](#callback-parameters)
* [Partner parameters](#partner-parameters)
* [Callback identifier](#callback-id)
* [Subscription tracking](#subscription-tracking)
* [Session parameters](#session-parameters)
* [Session callback parameters](#session-callback-parameters)
* [Session partner parameters](#session-partner-parameters)
Expand Down Expand Up @@ -387,6 +388,89 @@ adjustEvent.setCallbackId("Your-Custom-Id");
Adjust.trackEvent(adjustEvent);
```

### <a id="subscription-tracking"></a>Subscription tracking

**Note**: This feature is only available in the SDK v4.22.0 and above.

You can track App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After a subscription has been successfully purchased, make the following call to the Adjust SDK:

**For App Store subscription:**

```js
var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);

Adjust.trackAppStoreSubscription(subscription);
```

**For Play Store subscription:**

```js
var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
subscription.setPurchaseTime(purchaseTime);

Adjust.trackPlayStoreSubscription(subscription);
```

Subscription tracking parameters for App Store subscription:

- [price](https://developer.apple.com/documentation/storekit/skproduct/1506094-price?language=objc)
- currency (you need to pass [currencyCode](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object)
- [transactionId](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier?language=objc)
- [receipt](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl)
- [transactionDate](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411273-transactiondate?language=objc)
- salesRegion (you need to pass [countryCode](https://developer.apple.com/documentation/foundation/nslocale/1643060-countrycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object)

Subscription tracking parameters for Play Store subscription:

- [price](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpriceamountmicros)
- [currency](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpricecurrencycode)
- [sku](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsku)
- [orderId](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getorderid)
- [signature](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsignature)
- [purchaseToken](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetoken)
- [purchaseTime](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetime)

**Note:** Subscription tracking API offered by Adjust SDK expects all parameters to be passed as `string` values. Parameters described above are the ones which API exects you to pass to subscription object prior to tracking subscription. There are various libraries which are handling in app purchases in React Native and each one of them should return information described above in some form upon successfully completed subscription purchase. You should locate where these parameters are placed in response you are getting from library you are using for in app purchases, extract those values and pass them to Adjust API as string values.

Just like with event tracking, you can attach callback and partner parameters to the subscription object as well:

**For App Store subscription:**

```js
var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);

// add callback parameters
subscription.addCallbackParameter("key", "value");
subscription.addCallbackParameter("foo", "bar");

// add partner parameters
subscription.addPartnerParameter("key", "value");
subscription.addPartnerParameter("foo", "bar");

Adjust.trackAppStoreSubscription(subscription);
```

**For Play Store subscription:**

```js
var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
subscription.setPurchaseTime(purchaseTime);

// add callback parameters
subscription.addCallbackParameter("key", "value");
subscription.addCallbackParameter("foo", "bar");

// add partner parameters
subscription.addPartnerParameter("key", "value");
subscription.addPartnerParameter("foo", "bar");

Adjust.trackPlayStoreSubscription(subscription);
```

### <a id="session-parameters"></a>Session parameters

Some parameters are saved to be sent in every event and session of the Adjust SDK. Once you have added any of these parameters, you don't need to add them every time, since they will be saved locally. If you add the same parameter twice, there will be no effect.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.21.0
4.22.0
Binary file modified android/libs/adjust-android.jar
Binary file not shown.
98 changes: 98 additions & 0 deletions android/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ && checkKey(mapConfig, "info4")) {
adjustConfig.setOnDeeplinkResponseListener(this);
}

// Start SDK.
com.adjust.sdk.Adjust.onCreate(adjustConfig);
com.adjust.sdk.Adjust.onResume();
}
Expand Down Expand Up @@ -352,6 +353,7 @@ public void trackEvent(ReadableMap mapEvent) {
}
}

// Track event.
com.adjust.sdk.Adjust.trackEvent(event);
}

Expand Down Expand Up @@ -401,6 +403,94 @@ public void trackAdRevenue(String source, String payload) {
}
}

@ReactMethod
public void trackPlayStoreSubscription(ReadableMap mapEvent) {
if (mapEvent == null) {
return;
}

long price = -1;
String currency = null;
String sku = null;
String orderId = null;
String signature = null;
String purchaseToken = null;
long purchaseTime = -1;
Map<String, Object> callbackParameters = null;
Map<String, Object> partnerParameters = null;

// Price.
if (checkKey(mapEvent, "price")) {
try {
price = Long.parseLong(mapEvent.getString("price"));
} catch (NumberFormatException ignore) {}
}

// Currency.
if (checkKey(mapEvent, "currency")) {
currency = mapEvent.getString("currency");
}

// SKU.
if (checkKey(mapEvent, "sku")) {
sku = mapEvent.getString("sku");
}

// Order ID.
if (checkKey(mapEvent, "orderId")) {
orderId = mapEvent.getString("orderId");
}

// Signature.
if (checkKey(mapEvent, "signature")) {
signature = mapEvent.getString("signature");
}

// Purchase token.
if (checkKey(mapEvent, "purchaseToken")) {
purchaseToken = mapEvent.getString("purchaseToken");
}

AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
price,
currency,
sku,
orderId,
signature,
purchaseToken);

// Purchase time.
if (checkKey(mapEvent, "purchaseTime")) {
try {
purchaseTime = Long.parseLong(mapEvent.getString("purchaseTime"));
subscription.setPurchaseTime(purchaseTime);
} catch (NumberFormatException ignore) {}
}

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

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

// Track subscription.
com.adjust.sdk.Adjust.trackPlayStoreSubscription(subscription);
}

@ReactMethod
public void addSessionCallbackParameter(String key, String value) {
com.adjust.sdk.Adjust.addSessionCallbackParameter(key, value);
Expand Down Expand Up @@ -547,6 +637,10 @@ public void setTestOptions(ReadableMap mapTest) {
String value = mapTest.getString("gdprUrl");
testOptions.gdprUrl = value;
}
if (checkKey(mapTest, "subscriptionUrl")) {
String value = mapTest.getString("subscriptionUrl");
testOptions.subscriptionUrl = value;
}
if (checkKey(mapTest, "basePath")) {
String value = mapTest.getString("basePath");
testOptions.basePath = value;
Expand All @@ -555,6 +649,10 @@ public void setTestOptions(ReadableMap mapTest) {
String value = mapTest.getString("gdprPath");
testOptions.gdprPath = value;
}
if (checkKey(mapTest, "subscriptionPath")) {
String value = mapTest.getString("subscriptionPath");
testOptions.subscriptionPath = value;
}
if (checkKey(mapTest, "useTestConnectionOptions")) {
boolean value = mapTest.getBoolean("useTestConnectionOptions");
testOptions.useTestConnectionOptions = value;
Expand Down
35 changes: 35 additions & 0 deletions docs/english/plugins/oaid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## OAID plugin

OAID is a new advertising ID available in devices with HMS (Huawei Mobile Service) version 2.6.2 or later. You can use it to attribute and track Android devices in markets where Google Play Services is not available.

The OAID plugin lets the Adjust React Native SDK read a device’s OAID value *in addition* to the other device IDs it searches for by default.

First, read the official [React Native SDK README][readme] and integrate the Adjust SDK into your app.

To let the Adjust SDK collect and track the OAID, follow these steps.

### Add the OAID plugin to your app

You can get the Adjust OAID plugin for React Native from `npm`:

```
npm install react-native-adjust-oaid --save
```

### Use the plugin

To read OAID values, call `AdjustOaid.ReadOaid()` before starting the SDK:

```js
import { AdjustOaid } from 'react-native-adjust-oaid';

AdjustOaid.readOaid();

// ...

Adjust.create(adjustConfig);
```

To stop the SDK from reading OAID values, call `AdjustOaid.doNotReadOaid()`.

[readme]: ../../../README.md
2 changes: 2 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
AdjustEvent,
AdjustConfig
} from 'react-native-adjust';
import { AdjustOaid } from 'react-native-adjust-oaid';

const App: () => React$Node = () => {
Adjust.getSdkVersion(function(sdkVersion) {
Expand Down Expand Up @@ -107,6 +108,7 @@ const App: () => React$Node = () => {
// Adjust.resetSessionCallbackParameters();
// Adjust.resetSessionPartnerParameters();

AdjustOaid.readOaid();
Adjust.create(adjustConfig);

function componentDidMount() {
Expand Down
5 changes: 4 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "4.21.0"
versionName "4.22.0"
}
splits {
abi {
Expand Down Expand Up @@ -213,6 +213,9 @@ dependencies {
} else {
implementation jscFlavor
}

implementation 'com.android.installreferrer:installreferrer:1.1.2'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
}

// Run this once to be able to run the application with BUCK
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">AdjustExample</string>
<string name="app_name">Example</string>
</resources>
2 changes: 1 addition & 1 deletion example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "Example",
"displayName": "AdjustExample"
}
}
Loading