Skip to content

Commit 7ea341b

Browse files
Ji Limeta-codesync[bot]
authored andcommitted
Add additional AMM fields to AttributionData
Summary: This diff adds four new AMM (Advanced Measurement and Matching) fields to the Java Business SDK AttributionData class: 1. **attributionMethod** (AttributionMethodEnum): The attribution method used to attribute the event (values: ard, deeplink, gpir, invalid_response, mir, srn) 2. **declineReason** (DeclineReasonEnum): The decline reason for the attribution (values: lookback, inactive, fraud_detected, etc.) 3. **auditingToken** (String): The auditing token for the attribution 4. **linkageKey** (String): The linkage key for the attribution These fields are part of the ongoing work to enhance attribution tracking capabilities in the Conversions API. This builds upon the initial AMM fields added in v24.0.0. **Changes:** - Created new enum classes: `AttributionMethodEnum.java` and `DeclineReasonEnum.java` - Updated `AttributionData.java` with new fields, getters/setters, constructor parameters, equals/hashCode methods - Updated `AttributionDataTest.java` to test the new fields - Updated CHANGELOG.md to version v24.0.1 Reviewed By: danbunnell, satwikareddy3 Differential Revision: D85200208 Privacy Context Container: L1380952 fbshipit-source-id: 73ce2b8211e173f861458bd1dd162ed79e2f95b9
1 parent 94dde1a commit 7ea341b

File tree

6 files changed

+430
-13
lines changed

6 files changed

+430
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ All notable changes to this project will be documented in this file.
55

66
## Unreleased
77

8-
## v24.0.0
9-
8+
## v24.0.1
9+
### Added
10+
- Add additional AMM fields: attribution_method, decline_reason, auditing_token, linkage_key
11+
- Add attribution_setting field with inactivity_window_hours and reattribution_window_hours to AttributionData
1012

13+
## v24.0.0
1114
### Added
1215
- Add AMM fields to attribution data
1316

src/main/java/com/facebook/ads/sdk/serverside/AttributionData.java

Lines changed: 184 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ public class AttributionData {
5656

5757
@SerializedName("touchpoint_ts")
5858
private Integer touchpointTs = null;
59+
60+
@SerializedName("attribution_method")
61+
private AttributionMethodEnum attributionMethod = null;
62+
63+
@SerializedName("decline_reason")
64+
private DeclineReasonEnum declineReason = null;
65+
66+
@SerializedName("auditing_token")
67+
private String auditingToken = null;
68+
69+
@SerializedName("linkage_key")
70+
private String linkageKey = null;
71+
72+
@SerializedName("attribution_setting")
73+
private AttributionSetting attributionSetting = null;
5974

6075
/**
6176
* Default constructor
@@ -78,10 +93,16 @@ public AttributionData() {
7893
* @param attributionSource The attribution source to differentiate the source of the data, e.g. whether this is from AMM or Custom Attribution or any other sources.
7994
* @param touchpointType The engagement type that caused the original credited conversion.
8095
* @param touchpointTs The time when the touchpoint event occurred with the ad that the install was credited to.
96+
* @param attributionMethod The attribution method used to attribute the event.
97+
* @param declineReason The decline reason for the attribution.
98+
* @param auditingToken The auditing token for the attribution.
99+
* @param linkageKey The linkage key for the attribution.
100+
* @param attributionSetting The attribution setting with inactivity and reattribution window configuration.
81101
*/
82102
public AttributionData(String scope, Long visitTime, String adId, String adsetId, String campaignId,
83103
Float attributionShare, AttributionModelEnum attributionModel, Integer attributionWindow, Float attributionValue,
84-
String attributionSource, String touchpointType, Integer touchpointTs) {
104+
String attributionSource, String touchpointType, Integer touchpointTs, AttributionMethodEnum attributionMethod,
105+
DeclineReasonEnum declineReason, String auditingToken, String linkageKey, AttributionSetting attributionSetting) {
85106
this.scope = scope;
86107
this.visitTime = visitTime;
87108
this.adId = adId;
@@ -94,6 +115,11 @@ public AttributionData(String scope, Long visitTime, String adId, String adsetId
94115
this.attributionSource = attributionSource;
95116
this.touchpointType = touchpointType;
96117
this.touchpointTs = touchpointTs;
118+
this.attributionMethod = attributionMethod;
119+
this.declineReason = declineReason;
120+
this.auditingToken = auditingToken;
121+
this.linkageKey = linkageKey;
122+
this.attributionSetting = attributionSetting;
97123
}
98124

99125
/**
@@ -444,6 +470,151 @@ public void setTouchpointTs(Integer touchpointTs) {
444470
this.touchpointTs = touchpointTs;
445471
}
446472

473+
/**
474+
* Set attributionMethod
475+
*
476+
* @param attributionMethod The attribution method used to attribute the event.
477+
* @return AttributionData
478+
*/
479+
public AttributionData attributionMethod(AttributionMethodEnum attributionMethod) {
480+
this.attributionMethod = attributionMethod;
481+
return this;
482+
}
483+
484+
/**
485+
* Get attributionMethod
486+
*
487+
* @return attributionMethod
488+
*/
489+
public AttributionMethodEnum getAttributionMethod() {
490+
return attributionMethod;
491+
}
492+
493+
/**
494+
* Set attributionMethod
495+
*
496+
* @param attributionMethod The attribution method used to attribute the event.
497+
*/
498+
public void setAttributionMethod(AttributionMethodEnum attributionMethod) {
499+
this.attributionMethod = attributionMethod;
500+
}
501+
502+
/**
503+
* Set declineReason
504+
*
505+
* @param declineReason The decline reason for the attribution.
506+
* @return AttributionData
507+
*/
508+
public AttributionData declineReason(DeclineReasonEnum declineReason) {
509+
this.declineReason = declineReason;
510+
return this;
511+
}
512+
513+
/**
514+
* Get declineReason
515+
*
516+
* @return declineReason
517+
*/
518+
public DeclineReasonEnum getDeclineReason() {
519+
return declineReason;
520+
}
521+
522+
/**
523+
* Set declineReason
524+
*
525+
* @param declineReason The decline reason for the attribution.
526+
*/
527+
public void setDeclineReason(DeclineReasonEnum declineReason) {
528+
this.declineReason = declineReason;
529+
}
530+
531+
/**
532+
* Set auditingToken
533+
*
534+
* @param auditingToken The auditing token for the attribution.
535+
* @return AttributionData
536+
*/
537+
public AttributionData auditingToken(String auditingToken) {
538+
this.auditingToken = auditingToken;
539+
return this;
540+
}
541+
542+
/**
543+
* Get auditingToken
544+
*
545+
* @return auditingToken
546+
*/
547+
public String getAuditingToken() {
548+
return auditingToken;
549+
}
550+
551+
/**
552+
* Set auditingToken
553+
*
554+
* @param auditingToken The auditing token for the attribution.
555+
*/
556+
public void setAuditingToken(String auditingToken) {
557+
this.auditingToken = auditingToken;
558+
}
559+
560+
/**
561+
* Set linkageKey
562+
*
563+
* @param linkageKey The linkage key for the attribution.
564+
* @return AttributionData
565+
*/
566+
public AttributionData linkageKey(String linkageKey) {
567+
this.linkageKey = linkageKey;
568+
return this;
569+
}
570+
571+
/**
572+
* Get linkageKey
573+
*
574+
* @return linkageKey
575+
*/
576+
public String getLinkageKey() {
577+
return linkageKey;
578+
}
579+
580+
/**
581+
* Set linkageKey
582+
*
583+
* @param linkageKey The linkage key for the attribution.
584+
*/
585+
public void setLinkageKey(String linkageKey) {
586+
this.linkageKey = linkageKey;
587+
}
588+
589+
/**
590+
* Set attributionSetting
591+
*
592+
* @param attributionSetting The attribution setting with inactivity and reattribution window configuration.
593+
* @return AttributionData
594+
*/
595+
public AttributionData attributionSetting(AttributionSetting attributionSetting) {
596+
this.attributionSetting = attributionSetting;
597+
return this;
598+
}
599+
600+
/**
601+
* Get attributionSetting
602+
*
603+
* @return attributionSetting
604+
*/
605+
public AttributionSetting getAttributionSetting() {
606+
return attributionSetting;
607+
}
608+
609+
/**
610+
* Set attributionSetting
611+
*
612+
* @param attributionSetting The attribution setting with inactivity and reattribution window configuration.
613+
*/
614+
public void setAttributionSetting(AttributionSetting attributionSetting) {
615+
this.attributionSetting = attributionSetting;
616+
}
617+
447618
@Override
448619
public boolean equals(Object o) {
449620
if (this == o) return true;
@@ -462,12 +633,17 @@ public boolean equals(Object o) {
462633
&& Objects.equals(this.attributionValue, attributionData.attributionValue)
463634
&& Objects.equals(this.attributionSource, attributionData.attributionSource)
464635
&& Objects.equals(this.touchpointType, attributionData.touchpointType)
465-
&& Objects.equals(this.touchpointTs, attributionData.touchpointTs);
636+
&& Objects.equals(this.touchpointTs, attributionData.touchpointTs)
637+
&& Objects.equals(this.attributionMethod, attributionData.attributionMethod)
638+
&& Objects.equals(this.declineReason, attributionData.declineReason)
639+
&& Objects.equals(this.auditingToken, attributionData.auditingToken)
640+
&& Objects.equals(this.linkageKey, attributionData.linkageKey)
641+
&& Objects.equals(this.attributionSetting, attributionData.attributionSetting);
466642
}
467643

468644
@Override
469645
public int hashCode() {
470-
return Objects.hash(scope, visitTime, adId, adsetId, campaignId, attributionShare, attributionModel, attributionWindow, attributionValue, attributionSource, touchpointType, touchpointTs);
646+
return Objects.hash(scope, visitTime, adId, adsetId, campaignId, attributionShare, attributionModel, attributionWindow, attributionValue, attributionSource, touchpointType, touchpointTs, attributionMethod, declineReason, auditingToken, linkageKey, attributionSetting);
471647
}
472648

473649
@Override
@@ -486,6 +662,11 @@ public String toString() {
486662
sb.append(" attributionSource: ").append(toIndentedString(attributionSource)).append("\n");
487663
sb.append(" touchpointType: ").append(toIndentedString(touchpointType)).append("\n");
488664
sb.append(" touchpointTs: ").append(toIndentedString(touchpointTs)).append("\n");
665+
sb.append(" attributionMethod: ").append(toIndentedString(attributionMethod)).append("\n");
666+
sb.append(" declineReason: ").append(toIndentedString(declineReason)).append("\n");
667+
sb.append(" auditingToken: ").append(toIndentedString(auditingToken)).append("\n");
668+
sb.append(" linkageKey: ").append(toIndentedString(linkageKey)).append("\n");
669+
sb.append(" attributionSetting: ").append(toIndentedString(attributionSetting)).append("\n");
489670
sb.append("}");
490671
return sb.toString();
491672
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
3+
* <p>
4+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and
5+
* distribute this software in source code or binary form for use in connection with the web
6+
* services and APIs provided by Facebook.
7+
* <p>
8+
* As with any software that integrates with the Facebook platform, your use of this software is
9+
* subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/].
10+
* This copyright notice shall be included in all copies or substantial portions of the software.
11+
* <p>
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13+
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17+
*/
18+
package com.facebook.ads.sdk.serverside;
19+
20+
public enum AttributionMethodEnum {
21+
22+
ARD("ard"),
23+
DEEPLINK("deeplink"),
24+
GPIR("gpir"),
25+
INVALID_RESPONSE("invalid_response"),
26+
MIR("mir"),
27+
SRN("srn");
28+
29+
private String value;
30+
31+
AttributionMethodEnum(String value) {
32+
this.value = value;
33+
}
34+
35+
@Override
36+
public String toString() {
37+
return value;
38+
}
39+
40+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
3+
*
4+
* <p>You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify,
5+
* and distribute this software in source code or binary form for use in connection with the web
6+
* services and APIs provided by Facebook.
7+
*
8+
* <p>As with any software that integrates with the Facebook platform, your use of this software is
9+
* subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/].
10+
* This copyright notice shall be included in all copies or substantial portions of the software.
11+
*
12+
* <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
13+
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17+
*/
18+
package com.facebook.ads.sdk.serverside;
19+
20+
import com.google.gson.annotations.SerializedName;
21+
import java.util.Objects;
22+
23+
public class AttributionSetting {
24+
@SerializedName("inactivity_window_hours")
25+
private Integer inactivityWindowHours = null;
26+
27+
@SerializedName("reattribution_window_hours")
28+
private Integer reattributionWindowHours = null;
29+
30+
public AttributionSetting() {
31+
}
32+
33+
public AttributionSetting(Integer inactivityWindowHours, Integer reattributionWindowHours) {
34+
this.inactivityWindowHours = inactivityWindowHours;
35+
this.reattributionWindowHours = reattributionWindowHours;
36+
}
37+
38+
public AttributionSetting inactivityWindowHours(Integer inactivityWindowHours) {
39+
this.inactivityWindowHours = inactivityWindowHours;
40+
return this;
41+
}
42+
43+
public Integer getInactivityWindowHours() {
44+
return inactivityWindowHours;
45+
}
46+
47+
public void setInactivityWindowHours(Integer inactivityWindowHours) {
48+
this.inactivityWindowHours = inactivityWindowHours;
49+
}
50+
51+
public AttributionSetting reattributionWindowHours(Integer reattributionWindowHours) {
52+
this.reattributionWindowHours = reattributionWindowHours;
53+
return this;
54+
}
55+
56+
public Integer getReattributionWindowHours() {
57+
return reattributionWindowHours;
58+
}
59+
60+
public void setReattributionWindowHours(Integer reattributionWindowHours) {
61+
this.reattributionWindowHours = reattributionWindowHours;
62+
}
63+
64+
@Override
65+
public boolean equals(Object o) {
66+
if (this == o) return true;
67+
if (o == null || getClass() != o.getClass()) return false;
68+
69+
AttributionSetting attributionSetting = (AttributionSetting) o;
70+
71+
return Objects.equals(this.inactivityWindowHours, attributionSetting.inactivityWindowHours)
72+
&& Objects.equals(this.reattributionWindowHours, attributionSetting.reattributionWindowHours);
73+
}
74+
75+
@Override
76+
public int hashCode() {
77+
return Objects.hash(inactivityWindowHours, reattributionWindowHours);
78+
}
79+
80+
@Override
81+
public String toString() {
82+
StringBuilder sb = new StringBuilder();
83+
sb.append("class AttributionSetting {\n");
84+
sb.append(" inactivityWindowHours: ").append(toIndentedString(inactivityWindowHours)).append("\n");
85+
sb.append(" reattributionWindowHours: ").append(toIndentedString(reattributionWindowHours)).append("\n");
86+
sb.append("}");
87+
return sb.toString();
88+
}
89+
90+
private String toIndentedString(Object o) {
91+
if (o == null) {
92+
return "null";
93+
}
94+
return o.toString().replace("\n", "\n ");
95+
}
96+
}

0 commit comments

Comments
 (0)