Skip to content

Commit c326914

Browse files
committed
Merge pull request #128 from adjust/studymike-click_label
Studymike click label
2 parents 18d8932 + 478fb4d commit c326914

File tree

15 files changed

+68
-29
lines changed

15 files changed

+68
-29
lines changed

Adjust/adjust/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion 9
99
targetSdkVersion 21
1010
versionCode 1
11-
versionName "4.0.6"
11+
versionName "4.0.7"
1212
}
1313
}
1414

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public class AdjustAttribution implements Serializable {
2020
new ObjectStreamField("network", String.class),
2121
new ObjectStreamField("campaign", String.class),
2222
new ObjectStreamField("adgroup", String.class),
23-
new ObjectStreamField("creative", String.class)
23+
new ObjectStreamField("creative", String.class),
24+
new ObjectStreamField("clickLabel", String.class)
2425
};
2526

2627
public String trackerToken;
@@ -29,6 +30,7 @@ public class AdjustAttribution implements Serializable {
2930
public String campaign;
3031
public String adgroup;
3132
public String creative;
33+
public String clickLabel;
3234

3335
public static AdjustAttribution fromJson(JSONObject jsonObject) {
3436
if (jsonObject == null) return null;
@@ -41,6 +43,7 @@ public static AdjustAttribution fromJson(JSONObject jsonObject) {
4143
attribution.campaign = jsonObject.optString("campaign", null);
4244
attribution.adgroup = jsonObject.optString("adgroup", null);
4345
attribution.creative = jsonObject.optString("creative", null);
46+
attribution.clickLabel = jsonObject.optString("click_label", null);
4447

4548
return attribution;
4649
}
@@ -58,6 +61,7 @@ public boolean equals(Object other) {
5861
if (!Util.equalString(campaign, otherAttribution.campaign)) return false;
5962
if (!Util.equalString(adgroup, otherAttribution.adgroup)) return false;
6063
if (!Util.equalString(creative, otherAttribution.creative)) return false;
64+
if (!Util.equalString(clickLabel, otherAttribution.clickLabel)) return false;
6165
return true;
6266
}
6367

@@ -70,14 +74,15 @@ public int hashCode() {
7074
hashCode = 37 * hashCode + Util.hashString(campaign);
7175
hashCode = 37 * hashCode + Util.hashString(adgroup);
7276
hashCode = 37 * hashCode + Util.hashString(creative);
77+
hashCode = 37 * hashCode + Util.hashString(clickLabel);
7378
return hashCode;
7479
}
7580

7681

7782
@Override
7883
public String toString() {
79-
return String.format(Locale.US, "tt:%s tn:%s net:%s cam:%s adg:%s cre:%s",
80-
trackerToken, trackerName, network, campaign, adgroup, creative);
84+
return String.format(Locale.US, "tt:%s tn:%s net:%s cam:%s adg:%s cre:%s cl:%s",
85+
trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel);
8186
}
8287

8388
private void writeObject(ObjectOutputStream stream) throws IOException {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public interface Constants {
2727
String BASE_URL = "https://app.adjust.com";
2828
String SCHEME = "https";
2929
String AUTHORITY = "app.adjust.com";
30-
String CLIENT_SDK = "android4.0.6";
30+
String CLIENT_SDK = "android4.0.7";
3131
String LOGTAG = "Adjust";
3232

3333
String ACTIVITY_STATE_FILENAME = "AdjustIoActivityState";

Adjust/example/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ dependencies {
2828
// running mvn package
2929
//compile fileTree(dir: '../target', include: ['*.jar'])
3030
// using maven repository
31-
//compile 'com.adjust.sdk:adjust-android:4.0.6'
31+
//compile 'com.adjust.sdk:adjust-android:4.0.7'
3232
}

Adjust/plugin/AdjustCriteo.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ public class AdjustCriteo {
1919
private static String hashEmailInternal;
2020
private static String checkInDateInternal;
2121
private static String checkOutDateInternal;
22+
private static String partnerIdInternal;
2223

2324
public static void injectViewListingIntoEvent(AdjustEvent event, List<String> productIds, String customerId) {
2425
String jsonProducts = createCriteoVLFromProducts(productIds);
2526
event.addPartnerParameter("customer_id", customerId);
2627
event.addPartnerParameter("criteo_p", jsonProducts);
2728

28-
injectHashEmail(event);
29+
injectOptionalParams(event);
2930
}
3031

3132
public static void injectViewProductIntoEvent(AdjustEvent event, String productId, String customerId) {
3233
event.addPartnerParameter("customer_id", customerId);
3334
event.addPartnerParameter("criteo_p", productId);
3435

35-
injectHashEmail(event);
36+
injectOptionalParams(event);
3637
}
3738

3839
public static void injectCartIntoEvent(AdjustEvent event, List<CriteoProduct> products, String customerId) {
@@ -41,7 +42,7 @@ public static void injectCartIntoEvent(AdjustEvent event, List<CriteoProduct> pr
4142
event.addPartnerParameter("customer_id", customerId);
4243
event.addPartnerParameter("criteo_p", jsonProducts);
4344

44-
injectHashEmail(event);
45+
injectOptionalParams(event);
4546
}
4647

4748
public static void injectTransactionConfirmedIntoEvent(AdjustEvent event, List<CriteoProduct> products, String transactionId, String customerId) {
@@ -99,9 +100,14 @@ public static void injectViewSearchDatesIntoCriteoEvents(String checkInDate, Str
99100
checkOutDateInternal = checkOutDate;
100101
}
101102

103+
public static void injectPartnerIdIntoCriteoEvents(String partnerId) {
104+
partnerIdInternal = partnerId;
105+
}
106+
102107
private static void injectOptionalParams(AdjustEvent event) {
103108
injectHashEmail(event);
104109
injectSearchDates(event);
110+
injectPartnerId(event);
105111
}
106112
private static void injectHashEmail(AdjustEvent event) {
107113
if (hashEmailInternal == null || hashEmailInternal.isEmpty()) {
@@ -121,6 +127,15 @@ private static void injectSearchDates(AdjustEvent event) {
121127
event.addPartnerParameter("dout", checkOutDateInternal);
122128
}
123129

130+
private static void injectPartnerId(AdjustEvent event) {
131+
if (partnerIdInternal == null || partnerIdInternal.isEmpty()) {
132+
return;
133+
}
134+
135+
event.addPartnerParameter("criteo_partner_id", partnerIdInternal);
136+
}
137+
138+
124139
private static String createCriteoVLFromProducts(List<String> productIds) {
125140
if (productIds == null) {
126141
logger.warn("Criteo View Listing product ids list is null. It will sent as empty.");

Adjust/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<artifactId>adjust-android</artifactId>
77
<groupId>com.adjust.sdk</groupId>
8-
<version>4.0.6</version>
8+
<version>4.0.7</version>
99
<packaging>jar</packaging>
1010
<name>Adjust Android SDK</name>
1111
<url>https://github.com/adjust/android_sdk</url>

Adjust/test/src/androidTest/java/com/adjust/sdk/test/MockHttpClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public HttpResponse execute(HttpUriRequest request) throws IOException,
6262
"\"network\" : \"nValue\" , " +
6363
"\"campaign\" : \"cpValue\" , " +
6464
"\"adgroup\" : \"aValue\" , " +
65-
"\"creative\" : \"ctValue\" } }");
65+
"\"creative\" : \"ctValue\" , " +
66+
"\"click_label\" : \"clValue\" } }");
6667
} else if (responseType == ResponseType.ASK_IN) {
6768
return getOkResponse("{ \"ask_in\" : 4000 }");
6869
}

Adjust/test/src/androidTest/java/com/adjust/sdk/test/TestActivityHandler.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ public void testUpdateAttribution() {
988988

989989
// check that updates attribution
990990
assertUtil.isTrue(firstActivityHandler.tryUpdateAttribution(emptyAttribution));
991-
assertUtil.debug("Wrote Attribution: tt:null tn:null net:null cam:null adg:null cre:null");
991+
assertUtil.debug("Wrote Attribution: tt:null tn:null net:null cam:null adg:null cre:null cl:null");
992992

993993
emptyAttribution = AdjustAttribution.fromJson(emptyJsonResponse);
994994

@@ -1033,20 +1033,21 @@ public void onAttributionChanged(AdjustAttribution attribution) {
10331033
"\"network\" : \"nValue\" , " +
10341034
"\"campaign\" : \"cpValue\" , " +
10351035
"\"adgroup\" : \"aValue\" , " +
1036-
"\"creative\" : \"ctValue\" }");
1036+
"\"creative\" : \"ctValue\" , " +
1037+
"\"click_label\" : \"clValue\" }");
10371038
} catch (JSONException e) {
10381039
fail(e.getMessage());
10391040
}
10401041
AdjustAttribution firstAttribution = AdjustAttribution.fromJson(firstAttributionJson);
10411042

10421043
//check that it updates
10431044
assertUtil.isTrue(restartActivityHandler.tryUpdateAttribution(firstAttribution));
1044-
assertUtil.debug("Wrote Attribution: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue");
1045+
assertUtil.debug("Wrote Attribution: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue cl:clValue");
10451046

10461047
// check that it launch the saved attribute
10471048
SystemClock.sleep(1000);
10481049

1049-
assertUtil.test("onAttributionChanged: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue");
1050+
assertUtil.test("onAttributionChanged: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue cl:clValue");
10501051

10511052
// check that it does not update the attribution
10521053
assertUtil.isFalse(restartActivityHandler.tryUpdateAttribution(firstAttribution));
@@ -1089,20 +1090,21 @@ public void onAttributionChanged(AdjustAttribution attribution) {
10891090
"\"network\" : \"nValue2\" , " +
10901091
"\"campaign\" : \"cpValue2\" , " +
10911092
"\"adgroup\" : \"aValue2\" , " +
1092-
"\"creative\" : \"ctValue2\" }");
1093+
"\"creative\" : \"ctValue2\" , " +
1094+
"\"click_label\" : \"clValue2\" }");
10931095
} catch (JSONException e) {
10941096
fail(e.getMessage());
10951097
}
10961098
AdjustAttribution secondAttribution = AdjustAttribution.fromJson(secondAttributionJson);
10971099

10981100
//check that it updates
10991101
assertUtil.isTrue(secondRestartActivityHandler.tryUpdateAttribution(secondAttribution));
1100-
assertUtil.debug("Wrote Attribution: tt:ttValue2 tn:tnValue2 net:nValue2 cam:cpValue2 adg:aValue2 cre:ctValue2");
1102+
assertUtil.debug("Wrote Attribution: tt:ttValue2 tn:tnValue2 net:nValue2 cam:cpValue2 adg:aValue2 cre:ctValue2 cl:clValue2");
11011103

11021104
// check that it launch the saved attribute
11031105
SystemClock.sleep(1000);
11041106

1105-
assertUtil.test("onAttributionChanged: tt:ttValue2 tn:tnValue2 net:nValue2 cam:cpValue2 adg:aValue2 cre:ctValue2");
1107+
assertUtil.test("onAttributionChanged: tt:ttValue2 tn:tnValue2 net:nValue2 cam:cpValue2 adg:aValue2 cre:ctValue2 cl:clValue2");
11061108

11071109
// check that it does not update the attribution
11081110
assertUtil.isFalse(secondRestartActivityHandler.tryUpdateAttribution(secondAttribution));
@@ -1433,7 +1435,8 @@ public void onAttributionChanged(AdjustAttribution attribution) {
14331435
"\"network\" : \"nValue\" , " +
14341436
"\"campaign\" : \"cpValue\" , " +
14351437
"\"adgroup\" : \"aValue\" , " +
1436-
"\"creative\" : \"ctValue\" }");
1438+
"\"creative\" : \"ctValue\" , " +
1439+
"\"click_label\" : \"clValue\" }");
14371440
} catch (JSONException e) {
14381441
fail(e.getMessage());
14391442
}
@@ -1443,7 +1446,7 @@ public void onAttributionChanged(AdjustAttribution attribution) {
14431446
activityHandler.tryUpdateAttribution(attribution);
14441447

14451448
// attribution was updated
1446-
assertUtil.debug("Wrote Attribution: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue");
1449+
assertUtil.debug("Wrote Attribution: tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue cl:clValue");
14471450

14481451
// trigger a new sub session
14491452
activityHandler.trackSubsessionStart();

Adjust/test/src/androidTest/java/com/adjust/sdk/test/TestActivityPackage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public TestActivityPackage(ActivityPackage activityPackage) {
4747
// default values
4848
appToken = "123456789012";
4949
environment = "sandbox";
50-
clientSdk = "android4.0.6";
50+
clientSdk = "android4.0.7";
5151
suffix = "";
5252
attribution = new AdjustAttribution();
5353
}

Adjust/test/src/androidTest/java/com/adjust/sdk/test/TestAttributionHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,15 @@ private void attributionResponseTest(AttributionHandler attributionHandler, bool
323323
"\"network\" : \"nValue\" , " +
324324
"\"campaign\" : \"cpValue\" , " +
325325
"\"adgroup\" : \"aValue\" , " +
326-
"\"creative\" : \"ctValue\" } }";
326+
"\"creative\" : \"ctValue\" , " +
327+
"\"click_label\" : \"clValue\" } }";
327328

328329
mockActivityHandler.updated = updated;
329330

330331
callCheckAttributionWithGet(attributionHandler, ResponseType.ATTRIBUTION, response);
331332

332333
// check attribution was called without ask_in
333-
assertUtil.test("ActivityHandler tryUpdateAttribution, tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue");
334+
assertUtil.test("ActivityHandler tryUpdateAttribution, tt:ttValue tn:tnValue net:nValue cam:cpValue adg:aValue cre:ctValue cl:clValue");
334335

335336
// updated set askingAttribution to false
336337
assertUtil.test("ActivityHandler setAskingAttribution, false");
@@ -363,4 +364,4 @@ private void requestTest(HttpUriRequest request) {
363364

364365
assertUtil.isEqual("GET", request.getMethod());
365366
}
366-
}
367+
}

0 commit comments

Comments
 (0)