Skip to content

Commit

Permalink
Merge pull request #34 from adjust/v4220
Browse files Browse the repository at this point in the history
Version 4.22.0
  • Loading branch information
uerceg authored Jun 16, 2020
2 parents 774f13d + 297e92b commit b0662e3
Show file tree
Hide file tree
Showing 54 changed files with 1,314 additions and 54 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
### Version 4.22.0 (17th June 2020)
#### Added
- Added subscription tracking feature.
- Added support for Huawei App Gallery install referrer.
- Added `disableThirdPartySharing` method to `Adjust2dx` interface to allow disabling of data sharing with third parties outside of Adjust ecosystem.
- Added support for signature library as a plugin.
- Added more aggressive sending retry logic for install session package.
- Added additional parameters to `ad_revenue` package payload.
- Added external device ID support.

#### 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.18.0 (4th July 2019)
#### Added
- Added `trackAdRevenue` method to `Adjust2dx` interface to allow tracking of ad revenue. With this release added support for `MoPub` ad revenue tracking.
Expand Down Expand Up @@ -291,6 +310,7 @@
[ios_sdk_v4.17.1]: https://github.com/adjust/ios_sdk/tree/v4.17.1
[ios_sdk_v4.17.2]: https://github.com/adjust/ios_sdk/tree/v4.17.2
[ios_sdk_v4.18.0]: https://github.com/adjust/ios_sdk/tree/v4.18.0
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1

[android_sdk_v4.0.8]: https://github.com/adjust/android_sdk/tree/v4.0.8
[android_sdk_v4.1.0]: https://github.com/adjust/android_sdk/tree/v4.1.0
Expand All @@ -308,5 +328,6 @@
[android_sdk_v4.14.0]: https://github.com/adjust/android_sdk/tree/v4.14.0
[android_sdk_v4.17.0]: https://github.com/adjust/android_sdk/tree/v4.17.0
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0

[windows_sdk_v4.0.3]: https://github.com/adjust/windows_sdk/tree/v4.0.3
121 changes: 121 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This is the Cocos2d-x SDK of Adjust™. You can read more about Adjust™ at [Ad
* [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 All @@ -38,6 +39,7 @@ This is the Cocos2d-x SDK of Adjust™. You can read more about Adjust™ at [Ad
* [Offline mode](#offline-mode)
* [Event buffering](#event-buffering)
* [GDPR right to be forgotten](#gdpr-forget-me)
* [Disable third-party sharing](#disable-third-party-sharing)
* [SDK signature](#sdk-signature)
* [Background tracking](#background-tracking)
* [Device IDs](#device-ids)
Expand Down Expand Up @@ -390,6 +392,113 @@ adjustEvent.setCallbackId("Your-Custom-Id");
Adjust2dx::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:**

```cpp
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx(
price,
currency,
transactionId,
receipt
);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);

Adjust2dx::trackAppStoreSubscription(subscription);
```
**For Play Store subscription:**
```cpp
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx(
price,
currency,
sku,
orderId,
signature,
purchaseToken
);
subscription.setPurchaseTime(purchaseTime);
Adjust2dx::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 Cocos2d-x 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:**

```cpp
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx(
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");

Adjust2dx::trackAppStoreSubscription(subscription);
```
**For Play Store subscription:**
```cpp
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx(
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");
Adjust2dx::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 again, since they will be saved locally. If you add the same parameter twice, there will be no effect.
Expand Down Expand Up @@ -719,6 +828,18 @@ Adjust2dx::gdprForgetMe();

Upon receiving this information, Adjust will erase the user's data and the Adjust SDK will stop tracking the user. No requests from this device will be sent to Adjust in the future.

### <a id="disable-third-party-sharing"></a>Disable third-party sharing for specific users

You can now notify Adjust when a user has exercised their right to stop sharing their data with partners for marketing purposes, but has allowed it to be shared for statistics purposes.

Call the following method to instruct the Adjust SDK to communicate the user's choice to disable data sharing to the Adjust backend:

```cpp
Adjust2dx::disableThirdPartySharing();
```

Upon receiving this information, Adjust will block the sharing of that specific user's data to partners and the Adjust SDK will continue to work as usual.

### <a id="sdk-signature"></a>SDK signature

An account manager must activate the Adjust SDK signature. Contact Adjust support ([email protected]) if you are interested in using this feature.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.18.0
4.21.0
9 changes: 6 additions & 3 deletions dist/ADJAdjust2dx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
// Copyright © 2015-2019 Adjust GmbH. All rights reserved.
//

#ifndef _ADJUST_ADJUST2DX_H_
#define _ADJUST_ADJUST2DX_H_
#ifndef _ADJUST_ADJADJUST2DX_H_
#define _ADJUST_ADJADJUST2DX_H_

#include <map>
#include <iostream>
#include "ADJEvent2dx.h"
#include "ADJConfig2dx.h"
#include "ADJAppStoreSubscription2dx.h"
#include "AdjustAttribution2dx.h"

extern const std::string ADJEnvironmentSandbox2dx;
Expand All @@ -22,6 +23,7 @@ class ADJAdjust2dx {
public:
static void appDidLaunch(ADJConfig2dx adjustConfig);
static void trackEvent(ADJEvent2dx adjustEvent);
static void trackAppStoreSubscription(ADJAppStoreSubscription2dx subscription);
static void trackSubsessionStart();
static void trackSubsessionEnd();
static void setEnabled(bool isEnabled);
Expand All @@ -30,6 +32,7 @@ class ADJAdjust2dx {
static void setOfflineMode(bool isOffline);
static void sendFirstPackages();
static void gdprForgetMe();
static void disableThirdPartySharing();
static void addSessionCallbackParameter(std::string key, std::string value);
static void addSessionPartnerParameter(std::string key, std::string value);
static void removeSessionCallbackParameter(std::string key);
Expand All @@ -47,4 +50,4 @@ class ADJAdjust2dx {
static void teardown();
};

#endif /* _ADJUST_ADJUST2DX_H_ */
#endif /* _ADJUST_ADJADJUST2DX_H_ */
16 changes: 11 additions & 5 deletions dist/ADJAdjust2dx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
[Adjust trackEvent:(ADJEvent *)adjustEvent.getEvent()];
}

void ADJAdjust2dx::trackAppStoreSubscription(ADJAppStoreSubscription2dx subscription) {
[Adjust trackSubscription:(ADJSubscription *)subscription.getSubscription()];
}

void ADJAdjust2dx::trackSubsessionStart() {
[Adjust trackSubsessionStart];
}
Expand Down Expand Up @@ -82,6 +86,10 @@
[Adjust gdprForgetMe];
}

void ADJAdjust2dx::disableThirdPartySharing() {
[Adjust disableThirdPartySharing];
}

void ADJAdjust2dx::addSessionCallbackParameter(std::string key, std::string value) {
[Adjust addSessionCallbackParameter:[NSString stringWithUTF8String:key.c_str()] value:[NSString stringWithUTF8String:value.c_str()]];
}
Expand Down Expand Up @@ -188,12 +196,10 @@
AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init];
testOptions.baseUrl = [NSString stringWithUTF8String:testOptionsMap["baseUrl"].c_str()];
testOptions.gdprUrl = [NSString stringWithUTF8String:testOptionsMap["gdprUrl"].c_str()];
testOptions.subscriptionUrl = [NSString stringWithUTF8String:testOptionsMap["subscriptionUrl"].c_str()];

if (testOptionsMap.find("basePath") != testOptionsMap.end()) {
testOptions.basePath = [NSString stringWithUTF8String:testOptionsMap["basePath"].c_str()];
}
if (testOptionsMap.find("gdprPath") != testOptionsMap.end()) {
testOptions.gdprPath = [NSString stringWithUTF8String:testOptionsMap["gdprPath"].c_str()];
if (testOptionsMap.find("extraPath") != testOptionsMap.end()) {
testOptions.extraPath = [NSString stringWithUTF8String:testOptionsMap["extraPath"].c_str()];
}
if (testOptionsMap.find("timerIntervalInMilliseconds") != testOptionsMap.end()) {
NSString *timerIntervalMilliseconds = [NSString stringWithUTF8String:testOptionsMap["timerIntervalInMilliseconds"].c_str()];
Expand Down
32 changes: 32 additions & 0 deletions dist/ADJAppStoreSubscription2dx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// ADJAppStoreSubscription2dx.h
// Adjust SDK
//
// Created by Uglješa Erceg (@uerceg) on 12th June 2020.
// Copyright © 2015-2020 Adjust GmbH. All rights reserved.
//

#ifndef _ADJUST_ADJAPPSTORESUBSCRIPTION2DX_H_
#define _ADJUST_ADJAPPSTORESUBSCRIPTION2DX_H_

#include <iostream>

class ADJAppStoreSubscription2dx {
private:
void* subscription;
void initSubscription(std::string price, std::string currency, std::string transactionId, std::string receipt);

public:
ADJAppStoreSubscription2dx() {}
ADJAppStoreSubscription2dx(std::string price, std::string currency, std::string transactionId, std::string receipt) {
initSubscription(price, currency, transactionId, receipt);
}

void setTransactionDate(std::string transactionDate);
void setSalesRegion(std::string salesRegion);
void addCallbackParameter(std::string key, std::string value);
void addPartnerParameter(std::string key, std::string value);
void* getSubscription();
};

#endif /* _ADJUST_ADJAPPSTORESUBSCRIPTION2DX_H_ */
45 changes: 45 additions & 0 deletions dist/ADJAppStoreSubscription2dx.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// ADJAppStoreSubscription2dx.mm
// Adjust SDK
//
// Created by Uglješa Erceg (@uerceg) on 12th June 2020.
// Copyright © 2015-2020 Adjust GmbH. All rights reserved.
//

#include "ADJAppStoreSubscription2dx.h"
#include <AdjustSdk/ADJSubscription.h>

void ADJAppStoreSubscription2dx::initSubscription(std::string price, std::string currency, std::string transactionId, std::string receipt) {
NSString *strPrice = [NSString stringWithUTF8String:price.c_str()];
NSString *strCurrency = [NSString stringWithUTF8String:currency.c_str()];
NSString *strTransactionId = [NSString stringWithUTF8String:transactionId.c_str()];
NSString *strReceipt = [NSString stringWithUTF8String:receipt.c_str()];
subscription = [[ADJSubscription alloc] initWithPrice:[NSDecimalNumber decimalNumberWithString:strPrice]
currency:strCurrency
transactionId:strTransactionId
andReceipt:[strReceipt dataUsingEncoding:NSUTF8StringEncoding]];
}

void ADJAppStoreSubscription2dx::setTransactionDate(std::string transactionDate) {
NSString *strTransactionDate = [NSString stringWithUTF8String:transactionDate.c_str()];
[((ADJSubscription *)subscription) setTransactionDate:[NSDate dateWithTimeIntervalSince1970:[strTransactionDate doubleValue]]];
}

void ADJAppStoreSubscription2dx::setSalesRegion(std::string salesRegion) {
NSString *strSalesRegion = [NSString stringWithUTF8String:salesRegion.c_str()];
[((ADJSubscription *)subscription) setSalesRegion:strSalesRegion];
}

void ADJAppStoreSubscription2dx::addCallbackParameter(std::string key, std::string value) {
[((ADJSubscription *)subscription) addCallbackParameter:[NSString stringWithUTF8String:key.c_str()]
value:[NSString stringWithUTF8String:value.c_str()]];
}

void ADJAppStoreSubscription2dx::addPartnerParameter(std::string key, std::string value) {
[((ADJSubscription *)subscription) addPartnerParameter:[NSString stringWithUTF8String:key.c_str()]
value:[NSString stringWithUTF8String:value.c_str()]];
}

void* ADJAppStoreSubscription2dx::getSubscription() {
return subscription;
}
9 changes: 6 additions & 3 deletions dist/ADJConfig2dx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2015-2019 Adjust GmbH. All rights reserved.
//

#ifndef _ADJUST_ADJUSTCONFIG2DX_H_
#define _ADJUST_ADJUSTCONFIG2DX_H_
#ifndef _ADJUST_ADJCONFIG2DX_H_
#define _ADJUST_ADJCONFIG2DX_H_

#include <iostream>
#include "AdjustAttribution2dx.h"
Expand Down Expand Up @@ -49,8 +49,11 @@ class ADJConfig2dx {
void setLogLevel(ADJLogLevel2dx logLevel);
void setSendInBackground(bool isEnabled);
void setEventBufferingEnabled(bool isEnabled);
void setAllowIdfaReading(bool isAllowed);
void setAllowiAdInfoReading(bool isAllowed);
void setUserAgent(std::string userAgent);
void setDefaultTracker(std::string defaultTracker);
void setExternalDeviceId(std::string externalDeviceId);
void setAppSecret(long secretId, long info1, long info2, long info3, long info4);
void setIsDeviceKnown(bool isDeviceKnown);
void setAttributionCallback(void(*callbackMethod)(AdjustAttribution2dx attribution));
Expand All @@ -68,4 +71,4 @@ class ADJConfig2dx {
bool(*getDeferredDeeplinkCallback())(std::string);
};

#endif /* _ADJUST_ADJUSTCONFIG2DX_H_ */
#endif /* _ADJUST_ADJCONFIG2DX_H_ */
Loading

0 comments on commit b0662e3

Please sign in to comment.