Skip to content

Commit f69f33f

Browse files
authored
Merge pull request #91 from adjust/v4220
Version 4.22.0
2 parents 967e745 + 5dc968d commit f69f33f

File tree

99 files changed

+4415
-3116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+4415
-3116
lines changed

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ node_modules
1313
# Adjust SDK
1414
ext/
1515
example/
16-
test/
16+
test/
17+
plugins/
18+
docs/

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
### Version 4.22.0 (6th June 2020)
2+
#### Added
3+
- Added subscription tracking feature.
4+
- 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.
5+
- Added support for Huawei App Gallery install referrer.
6+
7+
#### Changed
8+
- Updated communication flow with `iAd.framework`.
9+
10+
#### Native SDKs
11+
- [[email protected]][ios_sdk_v4.22.1]
12+
- [[email protected]][android_sdk_v4.22.0]
13+
14+
---
15+
116
### Version 4.21.0 (1st April 2020)
217
#### Added
318
- Added `disableThirdPartySharing` method to `Adjust` interface to allow disabling of data sharing with third parties outside of Adjust ecosystem.
@@ -337,6 +352,8 @@
337352
[ios_sdk_v4.18.0]: https://github.com/adjust/ios_sdk/tree/v4.18.0
338353
[ios_sdk_v4.18.3]: https://github.com/adjust/ios_sdk/tree/v4.18.3
339354
[ios_sdk_v4.21.0]: https://github.com/adjust/ios_sdk/tree/v4.21.0
355+
[ios_sdk_v4.21.3]: https://github.com/adjust/ios_sdk/tree/v4.21.3
356+
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1
340357

341358
[android_sdk_v4.10.4]: https://github.com/adjust/android_sdk/tree/v4.10.4
342359
[android_sdk_v4.11.0]: https://github.com/adjust/android_sdk/tree/v4.11.0
@@ -355,3 +372,5 @@
355372
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0
356373
[android_sdk_v4.18.3]: https://github.com/adjust/android_sdk/tree/v4.18.3
357374
[android_sdk_v4.21.0]: https://github.com/adjust/android_sdk/tree/v4.21.0
375+
[android_sdk_v4.21.1]: https://github.com/adjust/android_sdk/tree/v4.21.1
376+
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This is the React Native SDK of Adjust™. You can read more about Adjust™ at
2525
* [Callback parameters](#callback-parameters)
2626
* [Partner parameters](#partner-parameters)
2727
* [Callback identifier](#callback-id)
28+
* [Subscription tracking](#subscription-tracking)
2829
* [Session parameters](#session-parameters)
2930
* [Session callback parameters](#session-callback-parameters)
3031
* [Session partner parameters](#session-partner-parameters)
@@ -387,6 +388,89 @@ adjustEvent.setCallbackId("Your-Custom-Id");
387388
Adjust.trackEvent(adjustEvent);
388389
```
389390

391+
### <a id="subscription-tracking"></a>Subscription tracking
392+
393+
**Note**: This feature is only available in the SDK v4.22.0 and above.
394+
395+
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:
396+
397+
**For App Store subscription:**
398+
399+
```js
400+
var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
401+
subscription.setTransactionDate(transactionDate);
402+
subscription.setSalesRegion(salesRegion);
403+
404+
Adjust.trackAppStoreSubscription(subscription);
405+
```
406+
407+
**For Play Store subscription:**
408+
409+
```js
410+
var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
411+
subscription.setPurchaseTime(purchaseTime);
412+
413+
Adjust.trackPlayStoreSubscription(subscription);
414+
```
415+
416+
Subscription tracking parameters for App Store subscription:
417+
418+
- [price](https://developer.apple.com/documentation/storekit/skproduct/1506094-price?language=objc)
419+
- 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)
420+
- [transactionId](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier?language=objc)
421+
- [receipt](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl)
422+
- [transactionDate](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411273-transactiondate?language=objc)
423+
- 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)
424+
425+
Subscription tracking parameters for Play Store subscription:
426+
427+
- [price](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpriceamountmicros)
428+
- [currency](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpricecurrencycode)
429+
- [sku](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsku)
430+
- [orderId](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getorderid)
431+
- [signature](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsignature)
432+
- [purchaseToken](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetoken)
433+
- [purchaseTime](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetime)
434+
435+
**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.
436+
437+
Just like with event tracking, you can attach callback and partner parameters to the subscription object as well:
438+
439+
**For App Store subscription:**
440+
441+
```js
442+
var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
443+
subscription.setTransactionDate(transactionDate);
444+
subscription.setSalesRegion(salesRegion);
445+
446+
// add callback parameters
447+
subscription.addCallbackParameter("key", "value");
448+
subscription.addCallbackParameter("foo", "bar");
449+
450+
// add partner parameters
451+
subscription.addPartnerParameter("key", "value");
452+
subscription.addPartnerParameter("foo", "bar");
453+
454+
Adjust.trackAppStoreSubscription(subscription);
455+
```
456+
457+
**For Play Store subscription:**
458+
459+
```js
460+
var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
461+
subscription.setPurchaseTime(purchaseTime);
462+
463+
// add callback parameters
464+
subscription.addCallbackParameter("key", "value");
465+
subscription.addCallbackParameter("foo", "bar");
466+
467+
// add partner parameters
468+
subscription.addPartnerParameter("key", "value");
469+
subscription.addPartnerParameter("foo", "bar");
470+
471+
Adjust.trackPlayStoreSubscription(subscription);
472+
```
473+
390474
### <a id="session-parameters"></a>Session parameters
391475

392476
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.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.21.0
1+
4.22.0

android/libs/adjust-android.jar

9.23 KB
Binary file not shown.

android/src/main/java/com/adjust/sdk/Adjust.java

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ && checkKey(mapConfig, "info4")) {
279279
adjustConfig.setOnDeeplinkResponseListener(this);
280280
}
281281

282+
// Start SDK.
282283
com.adjust.sdk.Adjust.onCreate(adjustConfig);
283284
com.adjust.sdk.Adjust.onResume();
284285
}
@@ -352,6 +353,7 @@ public void trackEvent(ReadableMap mapEvent) {
352353
}
353354
}
354355

356+
// Track event.
355357
com.adjust.sdk.Adjust.trackEvent(event);
356358
}
357359

@@ -401,6 +403,94 @@ public void trackAdRevenue(String source, String payload) {
401403
}
402404
}
403405

406+
@ReactMethod
407+
public void trackPlayStoreSubscription(ReadableMap mapEvent) {
408+
if (mapEvent == null) {
409+
return;
410+
}
411+
412+
long price = -1;
413+
String currency = null;
414+
String sku = null;
415+
String orderId = null;
416+
String signature = null;
417+
String purchaseToken = null;
418+
long purchaseTime = -1;
419+
Map<String, Object> callbackParameters = null;
420+
Map<String, Object> partnerParameters = null;
421+
422+
// Price.
423+
if (checkKey(mapEvent, "price")) {
424+
try {
425+
price = Long.parseLong(mapEvent.getString("price"));
426+
} catch (NumberFormatException ignore) {}
427+
}
428+
429+
// Currency.
430+
if (checkKey(mapEvent, "currency")) {
431+
currency = mapEvent.getString("currency");
432+
}
433+
434+
// SKU.
435+
if (checkKey(mapEvent, "sku")) {
436+
sku = mapEvent.getString("sku");
437+
}
438+
439+
// Order ID.
440+
if (checkKey(mapEvent, "orderId")) {
441+
orderId = mapEvent.getString("orderId");
442+
}
443+
444+
// Signature.
445+
if (checkKey(mapEvent, "signature")) {
446+
signature = mapEvent.getString("signature");
447+
}
448+
449+
// Purchase token.
450+
if (checkKey(mapEvent, "purchaseToken")) {
451+
purchaseToken = mapEvent.getString("purchaseToken");
452+
}
453+
454+
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
455+
price,
456+
currency,
457+
sku,
458+
orderId,
459+
signature,
460+
purchaseToken);
461+
462+
// Purchase time.
463+
if (checkKey(mapEvent, "purchaseTime")) {
464+
try {
465+
purchaseTime = Long.parseLong(mapEvent.getString("purchaseTime"));
466+
subscription.setPurchaseTime(purchaseTime);
467+
} catch (NumberFormatException ignore) {}
468+
}
469+
470+
// Callback parameters.
471+
if (checkKey(mapEvent, "callbackParameters")) {
472+
callbackParameters = AdjustUtil.toMap(mapEvent.getMap("callbackParameters"));
473+
if (null != callbackParameters) {
474+
for (Map.Entry<String, Object> entry : callbackParameters.entrySet()) {
475+
subscription.addCallbackParameter(entry.getKey(), entry.getValue().toString());
476+
}
477+
}
478+
}
479+
480+
// Partner parameters.
481+
if (checkKey(mapEvent, "partnerParameters")) {
482+
partnerParameters = AdjustUtil.toMap(mapEvent.getMap("partnerParameters"));
483+
if (null != partnerParameters) {
484+
for (Map.Entry<String, Object> entry : partnerParameters.entrySet()) {
485+
subscription.addPartnerParameter(entry.getKey(), entry.getValue().toString());
486+
}
487+
}
488+
}
489+
490+
// Track subscription.
491+
com.adjust.sdk.Adjust.trackPlayStoreSubscription(subscription);
492+
}
493+
404494
@ReactMethod
405495
public void addSessionCallbackParameter(String key, String value) {
406496
com.adjust.sdk.Adjust.addSessionCallbackParameter(key, value);
@@ -547,6 +637,10 @@ public void setTestOptions(ReadableMap mapTest) {
547637
String value = mapTest.getString("gdprUrl");
548638
testOptions.gdprUrl = value;
549639
}
640+
if (checkKey(mapTest, "subscriptionUrl")) {
641+
String value = mapTest.getString("subscriptionUrl");
642+
testOptions.subscriptionUrl = value;
643+
}
550644
if (checkKey(mapTest, "basePath")) {
551645
String value = mapTest.getString("basePath");
552646
testOptions.basePath = value;
@@ -555,6 +649,10 @@ public void setTestOptions(ReadableMap mapTest) {
555649
String value = mapTest.getString("gdprPath");
556650
testOptions.gdprPath = value;
557651
}
652+
if (checkKey(mapTest, "subscriptionPath")) {
653+
String value = mapTest.getString("subscriptionPath");
654+
testOptions.subscriptionPath = value;
655+
}
558656
if (checkKey(mapTest, "useTestConnectionOptions")) {
559657
boolean value = mapTest.getBoolean("useTestConnectionOptions");
560658
testOptions.useTestConnectionOptions = value;

docs/english/plugins/oaid.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## OAID plugin
2+
3+
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.
4+
5+
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.
6+
7+
First, read the official [React Native SDK README][readme] and integrate the Adjust SDK into your app.
8+
9+
To let the Adjust SDK collect and track the OAID, follow these steps.
10+
11+
### Add the OAID plugin to your app
12+
13+
You can get the Adjust OAID plugin for React Native from `npm`:
14+
15+
```
16+
npm install react-native-adjust-oaid --save
17+
```
18+
19+
### Use the plugin
20+
21+
To read OAID values, call `AdjustOaid.ReadOaid()` before starting the SDK:
22+
23+
```js
24+
import { AdjustOaid } from 'react-native-adjust-oaid';
25+
26+
AdjustOaid.readOaid();
27+
28+
// ...
29+
30+
Adjust.create(adjustConfig);
31+
```
32+
33+
To stop the SDK from reading OAID values, call `AdjustOaid.doNotReadOaid()`.
34+
35+
[readme]: ../../../README.md

example/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
AdjustEvent,
2929
AdjustConfig
3030
} from 'react-native-adjust';
31+
import { AdjustOaid } from 'react-native-adjust-oaid';
3132

3233
const App: () => React$Node = () => {
3334
Adjust.getSdkVersion(function(sdkVersion) {
@@ -107,6 +108,7 @@ const App: () => React$Node = () => {
107108
// Adjust.resetSessionCallbackParameters();
108109
// Adjust.resetSessionPartnerParameters();
109110

111+
AdjustOaid.readOaid();
110112
Adjust.create(adjustConfig);
111113

112114
function componentDidMount() {

example/android/app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ android {
133133
minSdkVersion rootProject.ext.minSdkVersion
134134
targetSdkVersion rootProject.ext.targetSdkVersion
135135
versionCode 1
136-
versionName "4.21.0"
136+
versionName "4.22.0"
137137
}
138138
splits {
139139
abi {
@@ -213,6 +213,9 @@ dependencies {
213213
} else {
214214
implementation jscFlavor
215215
}
216+
217+
implementation 'com.android.installreferrer:installreferrer:1.1.2'
218+
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
216219
}
217220

218221
// Run this once to be able to run the application with BUCK
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">AdjustExample</string>
2+
<string name="app_name">Example</string>
33
</resources>

0 commit comments

Comments
 (0)