Skip to content

Commit 74cb2b9

Browse files
authored
Merge pull request #198 from adjust/v4240
Version 4.24.0
2 parents 71833d9 + 6219764 commit 74cb2b9

26 files changed

+170
-16
lines changed

Assets/Adjust/Android/AdjustAndroid.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace com.adjust.sdk
88
#if UNITY_ANDROID
99
public class AdjustAndroid
1010
{
11-
private const string sdkPrefix = "unity4.23.2";
11+
private const string sdkPrefix = "unity4.24.0";
1212
private static bool launchDeferredDeeplink = true;
1313
private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
1414
private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
@@ -86,6 +86,18 @@ public static void Start(AdjustConfig adjustConfig)
8686
ajoAdjustConfig.Call("setSendInBackground", adjustConfig.sendInBackground.Value);
8787
}
8888

89+
// Check if user wants to get cost data in attribution callback.
90+
if (adjustConfig.needsCost != null)
91+
{
92+
ajoAdjustConfig.Call("setNeedsCost", adjustConfig.needsCost.Value);
93+
}
94+
95+
// Check if user wants to run preinstall campaigns.
96+
if (adjustConfig.preinstallTrackingEnabled != null)
97+
{
98+
ajoAdjustConfig.Call("setPreinstallTrackingEnabled", adjustConfig.preinstallTrackingEnabled.Value);
99+
}
100+
89101
// Check if user has set user agent value.
90102
if (adjustConfig.userAgent != null)
91103
{
@@ -311,6 +323,21 @@ public static AdjustAttribution GetAttribution()
311323
null : ajoAttribution.Get<string>(AdjustUtils.KeyClickLabel);
312324
adjustAttribution.adid = ajoAttribution.Get<string>(AdjustUtils.KeyAdid) == "" ?
313325
null : ajoAttribution.Get<string>(AdjustUtils.KeyAdid);
326+
adjustAttribution.costType = ajoAttribution.Get<string>(AdjustUtils.KeyCostType) == "" ?
327+
null : ajoAttribution.Get<string>(AdjustUtils.KeyCostType);
328+
AndroidJavaObject ajoCostAmount = ajoAttribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount) == null ?
329+
null : ajoAttribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount);
330+
if (ajoCostAmount == null)
331+
{
332+
adjustAttribution.costAmount = null;
333+
}
334+
else
335+
{
336+
double costAmount = ajoCostAmount.Call<double>("doubleValue");
337+
adjustAttribution.costAmount = costAmount;
338+
}
339+
adjustAttribution.costCurrency = ajoAttribution.Get<string>(AdjustUtils.KeyCostCurrency) == "" ?
340+
null : ajoAttribution.Get<string>(AdjustUtils.KeyCostCurrency);
314341
return adjustAttribution;
315342
}
316343
catch (Exception) {}
@@ -506,6 +533,21 @@ public void onAttributionChanged(AndroidJavaObject attribution)
506533
null : attribution.Get<string>(AdjustUtils.KeyClickLabel);
507534
adjustAttribution.adid = attribution.Get<string>(AdjustUtils.KeyAdid) == "" ?
508535
null : attribution.Get<string>(AdjustUtils.KeyAdid);
536+
adjustAttribution.costType = attribution.Get<string>(AdjustUtils.KeyCostType) == "" ?
537+
null : attribution.Get<string>(AdjustUtils.KeyCostType);
538+
AndroidJavaObject ajoCostAmount = attribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount) == null ?
539+
null : attribution.Get<AndroidJavaObject>(AdjustUtils.KeyCostAmount);
540+
if (ajoCostAmount == null)
541+
{
542+
adjustAttribution.costAmount = null;
543+
}
544+
else
545+
{
546+
double costAmount = ajoCostAmount.Call<double>("doubleValue");
547+
adjustAttribution.costAmount = costAmount;
548+
}
549+
adjustAttribution.costCurrency = attribution.Get<string>(AdjustUtils.KeyCostCurrency) == "" ?
550+
null : attribution.Get<string>(AdjustUtils.KeyCostCurrency);
509551
callback(adjustAttribution);
510552
}
511553
}
-42 Bytes
Binary file not shown.
843 Bytes
Binary file not shown.

Assets/Adjust/Test/CommandExecutor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ private void Config()
351351
_testLibrary.AddInfoToSend("creative", attribution.creative);
352352
_testLibrary.AddInfoToSend("clickLabel", attribution.clickLabel);
353353
_testLibrary.AddInfoToSend("adid", attribution.adid);
354+
_testLibrary.AddInfoToSend("costType", attribution.costType);
355+
_testLibrary.AddInfoToSend("costAmount", attribution.costAmount.ToString());
356+
_testLibrary.AddInfoToSend("costCurrency", attribution.costCurrency);
354357
_testLibrary.SendInfoToServer(localExtraPath);
355358
});
356359
}

Assets/Adjust/Test/TestApp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class TestApp : MonoBehaviour
1616
#elif UNITY_ANDROID
1717
private const string PORT = ":8443";
1818
private const string PROTOCOL = "https://";
19-
private const string IP = "192.168.86.32";
19+
private const string IP = "192.168.86.33";
2020
#elif UNITY_IOS
2121
private const string PORT = ":8080";
2222
private const string PROTOCOL = "http://";
23-
private const string IP = "192.168.86.32";
23+
private const string IP = "192.168.86.33";
2424
private TestLibraryiOS _testLibraryiOS;
2525
#endif
2626
private const string BASE_URL = PROTOCOL + IP + PORT;

Assets/Adjust/Unity/AdjustAttribution.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public class AdjustAttribution
1313
public string clickLabel { get; set; }
1414
public string trackerName { get; set; }
1515
public string trackerToken { get; set; }
16+
public string costType { get; set; }
17+
public double? costAmount { get; set; }
18+
public string costCurrency { get; set; }
1619

1720
public AdjustAttribution() {}
1821

@@ -32,6 +35,10 @@ public AdjustAttribution(string jsonString)
3235
creative = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCreative);
3336
clickLabel = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyClickLabel);
3437
adid = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyAdid);
38+
costType = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostType);
39+
costAmount = double.Parse(AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostAmount),
40+
System.Globalization.CultureInfo.InvariantCulture);
41+
costCurrency = AdjustUtils.GetJsonString(jsonNode, AdjustUtils.KeyCostCurrency);
3542
}
3643

3744
public AdjustAttribution(Dictionary<string, string> dicAttributionData)
@@ -49,6 +56,10 @@ public AdjustAttribution(Dictionary<string, string> dicAttributionData)
4956
creative = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCreative);
5057
clickLabel = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyClickLabel);
5158
adid = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyAdid);
59+
costType = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostType);
60+
costAmount = double.Parse(AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostAmount),
61+
System.Globalization.CultureInfo.InvariantCulture);
62+
costCurrency = AdjustUtils.TryGetValue(dicAttributionData, AdjustUtils.KeyCostCurrency);
5263
}
5364
}
5465
}

Assets/Adjust/Unity/AdjustConfig.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AdjustConfig
2424
internal bool? sendInBackground;
2525
internal bool? eventBufferingEnabled;
2626
internal bool? allowSuppressLogLevel;
27-
internal bool? skAdNetworkHandling;
27+
internal bool? needsCost;
2828
internal bool launchDeferredDeeplink;
2929
internal AdjustLogLevel? logLevel;
3030
internal AdjustEnvironment environment;
@@ -37,10 +37,12 @@ public class AdjustConfig
3737

3838
// Android specific members
3939
internal bool? readImei;
40+
internal bool? preinstallTrackingEnabled;
4041
internal string processName;
4142
// iOS specific members
4243
internal bool? allowiAdInfoReading;
4344
internal bool? allowIdfaReading;
45+
internal bool? skAdNetworkHandling;
4446
// Windows specific members
4547
internal Action<String> logDelegate;
4648

@@ -91,6 +93,11 @@ public void setEventBufferingEnabled(bool eventBufferingEnabled)
9193
this.eventBufferingEnabled = eventBufferingEnabled;
9294
}
9395

96+
public void setNeedsCost(bool needsCost)
97+
{
98+
this.needsCost = needsCost;
99+
}
100+
94101
public void setDelayStart(double delayStart)
95102
{
96103
this.delayStart = delayStart;
@@ -214,6 +221,11 @@ public void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity)
214221
// this.readImei = readMobileEquipmentIdentity;
215222
}
216223

224+
public void setPreinstallTrackingEnabled(bool preinstallTrackingEnabled)
225+
{
226+
this.preinstallTrackingEnabled = preinstallTrackingEnabled;
227+
}
228+
217229
// Windows specific methods.
218230
public void setLogDelegate(Action<String> logDelegate)
219231
{

Assets/Adjust/Unity/AdjustUtils.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class AdjustUtils
2121
public static string KeyTrackerName = "trackerName";
2222
public static string KeyTrackerToken = "trackerToken";
2323
public static string KeyJsonResponse = "jsonResponse";
24+
public static string KeyCostType = "costType";
25+
public static string KeyCostAmount = "costAmount";
26+
public static string KeyCostCurrency = "costCurrency";
2427

2528
// For testing purposes.
2629
public static string KeyTestOptionsBaseUrl = "baseUrl";

Assets/Adjust/Windows/AdjustWindows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace com.adjust.sdk
1717
{
1818
public class AdjustWindows
1919
{
20-
private const string sdkPrefix = "unity4.23.2";
20+
private const string sdkPrefix = "unity4.24.0";
2121
private static bool appLaunched = false;
2222

2323
public static void Start(AdjustConfig adjustConfig)

Assets/Adjust/iOS/ADJAttribution.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@
5353
*/
5454
@property (nonatomic, copy, nullable) NSString *adid;
5555

56+
/**
57+
* @brief Cost type.
58+
*/
59+
@property (nonatomic, copy, nullable) NSString *costType;
60+
61+
/**
62+
* @brief Cost amount.
63+
*/
64+
@property (nonatomic, copy, nullable) NSNumber *costAmount;
65+
66+
/**
67+
* @brief Cost currency.
68+
*/
69+
@property (nonatomic, copy, nullable) NSString *costCurrency;
70+
5671
/**
5772
* @brief Make attribution object.
5873
*

Assets/Adjust/iOS/ADJConfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@
168168
*/
169169
@property (nonatomic, assign) BOOL isDeviceKnown;
170170

171+
/**
172+
* @brief Set if cost data is needed in attribution response.
173+
*/
174+
@property (nonatomic, assign) BOOL needsCost;
175+
171176
/**
172177
* @brief Adjust app secret id.
173178
*/

Assets/Adjust/iOS/Adjust.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Adjust.h
33
// Adjust
44
//
5-
// V4.23.2
5+
// V4.24.0
66
// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
77
// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
88
//

Assets/Adjust/iOS/AdjustSdk.a

344 KB
Binary file not shown.

Assets/Adjust/iOS/AdjustUnity.mm

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ BOOL isStringValid(const char* cString) {
6868

6969
void addValueOrEmpty(NSMutableDictionary *dictionary, NSString *key, NSObject *value) {
7070
if (nil != value) {
71-
[dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
71+
if ([value isKindOfClass:[NSString class]]) {
72+
[dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
73+
} else if ([value isKindOfClass:[NSNumber class]]) {
74+
[dictionary setObject:[NSString stringWithFormat:@"%@", [((NSNumber *)value) stringValue]] forKey:key];
75+
} else {
76+
[dictionary setObject:@"" forKey:key];
77+
}
7278
} else {
7379
[dictionary setObject:@"" forKey:key];
7480
}
@@ -94,6 +100,7 @@ void _AdjustLaunchApp(const char* appToken,
94100
int allowiAdInfoReading,
95101
int allowIdfaReading,
96102
int deactivateSkAdNetworkHandling,
103+
int needsCost,
97104
int64_t secretId,
98105
int64_t info1,
99106
int64_t info2,
@@ -188,6 +195,11 @@ void _AdjustLaunchApp(const char* appToken,
188195
[adjustConfig setDelayStart:delayStart];
189196
}
190197

198+
// Cost data in attribution callback.
199+
if (needsCost != -1) {
200+
[adjustConfig setNeedsCost:(BOOL)needsCost];
201+
}
202+
191203
// User agent.
192204
if (stringUserAgent != nil) {
193205
[adjustConfig setUserAgent:stringUserAgent];
@@ -400,6 +412,9 @@ void _AdjustAppWillOpenUrl(const char* url) {
400412
addValueOrEmpty(dictionary, @"adgroup", attribution.adgroup);
401413
addValueOrEmpty(dictionary, @"clickLabel", attribution.clickLabel);
402414
addValueOrEmpty(dictionary, @"adid", attribution.adid);
415+
addValueOrEmpty(dictionary, @"costType", attribution.costType);
416+
addValueOrEmpty(dictionary, @"costAmount", attribution.costAmount);
417+
addValueOrEmpty(dictionary, @"costCurrency", attribution.costCurrency);
403418

404419
NSData *dataAttribution = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
405420
NSString *stringAttribution = [[NSString alloc] initWithBytes:[dataAttribution bytes]

Assets/Adjust/iOS/AdjustUnityDelegate.mm

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
9191
[self addValueOrEmpty:attribution.adgroup forKey:@"adgroup" toDictionary:dictionary];
9292
[self addValueOrEmpty:attribution.clickLabel forKey:@"clickLabel" toDictionary:dictionary];
9393
[self addValueOrEmpty:attribution.adid forKey:@"adid" toDictionary:dictionary];
94+
[self addValueOrEmpty:attribution.costType forKey:@"costType" toDictionary:dictionary];
95+
[self addValueOrEmpty:attribution.costAmount forKey:@"costAmount" toDictionary:dictionary];
96+
[self addValueOrEmpty:attribution.costCurrency forKey:@"costCurrency" toDictionary:dictionary];
9497

9598
NSData *dataAttribution = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
9699
NSString *stringAttribution = [[NSString alloc] initWithBytes:[dataAttribution bytes]
@@ -221,7 +224,13 @@ - (void)addValueOrEmpty:(NSObject *)value
221224
forKey:(NSString *)key
222225
toDictionary:(NSMutableDictionary *)dictionary {
223226
if (nil != value) {
224-
[dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
227+
if ([value isKindOfClass:[NSString class]]) {
228+
[dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
229+
} else if ([value isKindOfClass:[NSNumber class]]) {
230+
[dictionary setObject:[NSString stringWithFormat:@"%@", [((NSNumber *)value) stringValue]] forKey:key];
231+
} else {
232+
[dictionary setObject:@"" forKey:key];
233+
}
225234
} else {
226235
[dictionary setObject:@"" forKey:key];
227236
}

Assets/Adjust/iOS/AdjustiOS.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace com.adjust.sdk
88
#if UNITY_IOS
99
public class AdjustiOS
1010
{
11-
private const string sdkPrefix = "unity4.23.2";
11+
private const string sdkPrefix = "unity4.24.0";
1212

1313
[DllImport("__Internal")]
1414
private static extern void _AdjustLaunchApp(
@@ -28,6 +28,7 @@ private static extern void _AdjustLaunchApp(
2828
int allowiAdInfoReading,
2929
int allowIdfaReading,
3030
int deactivateSkAdNetworkHandling,
31+
int needsCost,
3132
long secretId,
3233
long info1,
3334
long info2,
@@ -173,6 +174,7 @@ public static void Start(AdjustConfig adjustConfig)
173174
int allowSuppressLogLevel = AdjustUtils.ConvertBool(adjustConfig.allowSuppressLogLevel);
174175
int launchDeferredDeeplink = AdjustUtils.ConvertBool(adjustConfig.launchDeferredDeeplink);
175176
int deactivateSkAdNetworkHandling = AdjustUtils.ConvertBool(adjustConfig.skAdNetworkHandling);
177+
int needsCost = AdjustUtils.ConvertBool(adjustConfig.needsCost);
176178
int isAttributionCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getAttributionChangedDelegate() != null);
177179
int isEventSuccessCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getEventSuccessDelegate() != null);
178180
int isEventFailureCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getEventFailureDelegate() != null);
@@ -197,6 +199,7 @@ public static void Start(AdjustConfig adjustConfig)
197199
allowiAdInfoReading,
198200
allowIdfaReading,
199201
deactivateSkAdNetworkHandling,
202+
needsCost,
200203
secretId,
201204
info1,
202205
info2,
-116 KB
Binary file not shown.
-268 Bytes
Binary file not shown.

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
### Version 4.24.0 (11th December 2020)
2+
#### Added
3+
- Added possibility to get cost data information in attribution callback.
4+
- Added `setNeedsCost` method to `AdjustConfig` to indicate if cost data is needed in attribution callback (by default cost data will not be part of attribution callback if not enabled with this setter method).
5+
- Added `setPreinstallTrackingEnabled` method to `AdjustConfig` to allow enabling of preintall tracking (this feature is OFF by default).
6+
- Added support for MSA SDK v1.0.23 in OAID plugin.
7+
8+
#### Native SDKs
9+
- [[email protected]][ios_sdk_v4.24.0]
10+
- [[email protected]][android_sdk_v4.25.0]
11+
- [[email protected]][windows_sdk_v4.17.0]
12+
13+
---
14+
115
### Version 4.23.2 (2nd October 2020)
216
#### Added
317
- Added note to `Assets/Adjust` menu toggling actions that project needs to be saved in order for actions to take effect.
@@ -794,6 +808,7 @@
794808
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1
795809
[ios_sdk_v4.23.0]: https://github.com/adjust/ios_sdk/tree/v4.23.0
796810
[ios_sdk_v4.23.2]: https://github.com/adjust/ios_sdk/tree/v4.23.2
811+
[ios_sdk_v4.24.0]: https://github.com/adjust/ios_sdk/tree/v4.24.0
797812

798813
[android_sdk_v3.5.0]: https://github.com/adjust/android_sdk/tree/v3.5.0
799814
[android_sdk_v4.1.0]: https://github.com/adjust/android_sdk/tree/v4.1.0
@@ -823,6 +838,7 @@
823838
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0
824839
[android_sdk_v4.24.0]: https://github.com/adjust/android_sdk/tree/v4.24.0
825840
[android_sdk_v4.24.1]: https://github.com/adjust/android_sdk/tree/v4.24.1
841+
[android_sdk_v4.25.0]: https://github.com/adjust/android_sdk/tree/v4.25.0
826842

827843
[windows_sdk_v4.12.0]: https://github.com/adjust/windows_sdk/tree/v4.12.0
828844
[windows_sdk_v4.13.0]: https://github.com/adjust/windows_sdk/tree/v4.13.0

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ The callback function will be called when the SDK receives final attribution dat
648648
- `string creative` the creative grouping level of the current attribution
649649
- `string clickLabel` the click label of the current attribution
650650
- `string adid` the Adjust device identifier
651+
- `string costType` the cost type string
652+
- `double? costAmount` the cost amount
653+
- `string costCurrency` the cost currency string
654+
655+
**Note**: The cost data - `costType`, `costAmount` & `costCurrency` are only available when configured in `AdjustConfig` by calling `setNeedsCost` method. If not configured or configured, but not being part of the attribution, these fields will have value `null`. This feature is available in SDK v4.24.0 and above.
651656

652657
### <a id="ad-ad-revenue"></a>Ad revenue tracking
653658

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.23.2
1+
4.24.0

doc/english/migration/migrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Migrate your Adjust SDK for Unity3d to 4.23.2 from 3.4.4
1+
## Migrate your Adjust SDK for Unity3d to 4.24.0 from 3.4.4
22

33
### Migration procedure
44

ext/android/sdk

Submodule sdk updated 52 files

ext/ios/sdk

Submodule sdk updated 58 files

0 commit comments

Comments
 (0)