Skip to content

Commit

Permalink
UOE-10030: fix: populate correct displayversionid in tracker macro (#704
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AvinashKapre authored Feb 9, 2024
1 parent b511f9f commit c1e8c4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/pubmatic/openwrap/beforevalidationhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ func getPageURL(bidRequest *openrtb2.BidRequest) string {
func getVASTEventMacros(rctx models.RequestCtx) map[string]string {
macros := map[string]string{
string(models.MacroProfileID): fmt.Sprintf("%d", rctx.ProfileID),
string(models.MacroProfileVersionID): fmt.Sprintf("%d", rctx.DisplayID),
string(models.MacroProfileVersionID): fmt.Sprintf("%d", rctx.DisplayVersionID),
string(models.MacroUnixTimeStamp): fmt.Sprintf("%d", rctx.StartTime),
string(models.MacroPlatform): fmt.Sprintf("%d", rctx.DeviceCtx.Platform),
string(models.MacroWrapperImpressionID): rctx.LoggerImpressionID,
Expand Down
4 changes: 2 additions & 2 deletions modules/pubmatic/openwrap/beforevalidationhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestGetVASTEventMacros(t *testing.T) {
args: args{
rctx: models.RequestCtx{
ProfileID: 1234,
DisplayID: 1234,
DisplayVersionID: 1234,
StartTime: 1234,
LoggerImpressionID: "1234",
SSAI: "",
Expand All @@ -187,7 +187,7 @@ func TestGetVASTEventMacros(t *testing.T) {
args: args{
rctx: models.RequestCtx{
ProfileID: 1234,
DisplayID: 1234,
DisplayVersionID: 1234,
StartTime: 1234,
LoggerImpressionID: "1234",
SSAI: "1234",
Expand Down
2 changes: 1 addition & 1 deletion modules/pubmatic/openwrap/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func GetTrackerInfo(rCtx models.RequestCtx, responseExt openrtb_ext.ExtBidRespon
tracker := models.Tracker{
PubID: rCtx.PubID,
ProfileID: fmt.Sprintf("%d", rCtx.ProfileID),
VersionID: fmt.Sprintf("%d", rCtx.DisplayID),
VersionID: fmt.Sprintf("%d", rCtx.DisplayVersionID),
PageURL: rCtx.PageURL,
Timestamp: rCtx.StartTime,
IID: rCtx.LoggerImpressionID,
Expand Down
12 changes: 7 additions & 5 deletions modules/pubmatic/openwrap/tracker/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/prebid/prebid-server/modules/pubmatic/openwrap/models"
"github.com/prebid/prebid-server/openrtb_ext"
"github.com/prebid/prebid-server/util/ptrutil"
"github.com/stretchr/testify/assert"
)

func TestGetTrackerInfo(t *testing.T) {
Expand All @@ -28,6 +29,7 @@ func TestGetTrackerInfo(t *testing.T) {
TrackerEndpoint: "localhost:8080/wt",
PubID: 123,
ProfileID: 1,
DisplayVersionID: 2,
VersionID: 1,
PageURL: "www.test.com",
LoggerImpressionID: "iid123",
Expand All @@ -45,7 +47,7 @@ func TestGetTrackerInfo(t *testing.T) {
},
responseExt: openrtb_ext.ExtBidResponse{},
},
want: "localhost:8080/wt?adv=&af=&aps=0&atts=1&au=%24%7BADUNIT%7D&bc=%24%7BBIDDER_CODE%7D&bidid=%24%7BBID_ID%7D&di=&eg=%24%7BG_ECPM%7D&en=%24%7BN_ECPM%7D&ft=0&iid=iid123&kgpv=%24%7BKGPV%7D&orig=www.publisher.com&origbidid=%24%7BORIGBID_ID%7D&pdvid=0&pid=1&plt=5&pn=%24%7BPARTNER_NAME%7D&psz=&pubid=123&purl=www.test.com&rwrd=%24%7BREWARDED%7D&sl=1&slot=%24%7BSLOT_ID%7D&ss=0&tgid=1&tst=" + strconv.FormatInt(startTime, 10),
want: "localhost:8080/wt?adv=&af=&aps=0&atts=1&au=%24%7BADUNIT%7D&bc=%24%7BBIDDER_CODE%7D&bidid=%24%7BBID_ID%7D&di=&eg=%24%7BG_ECPM%7D&en=%24%7BN_ECPM%7D&ft=0&iid=iid123&kgpv=%24%7BKGPV%7D&orig=www.publisher.com&origbidid=%24%7BORIGBID_ID%7D&pdvid=2&pid=1&plt=5&pn=%24%7BPARTNER_NAME%7D&psz=&pubid=123&purl=www.test.com&rwrd=%24%7BREWARDED%7D&sl=1&slot=%24%7BSLOT_ID%7D&ss=0&tgid=1&tst=" + strconv.FormatInt(startTime, 10),
},
{
name: "all_tracker_info_with_floors",
Expand All @@ -55,6 +57,7 @@ func TestGetTrackerInfo(t *testing.T) {
PubID: 123,
ProfileID: 1,
VersionID: 1,
DisplayVersionID: 2,
PageURL: "www.test.com",
LoggerImpressionID: "iid123",
StartTime: startTime,
Expand Down Expand Up @@ -83,14 +86,13 @@ func TestGetTrackerInfo(t *testing.T) {
},
},
},
want: "localhost:8080/wt?adv=&af=&aps=0&au=%24%7BADUNIT%7D&bc=%24%7BBIDDER_CODE%7D&bidid=%24%7BBID_ID%7D&di=&eg=%24%7BG_ECPM%7D&en=%24%7BN_ECPM%7D&fmv=version+1&fskp=1&fsrc=2&ft=1&iid=iid123&kgpv=%24%7BKGPV%7D&orig=www.publisher.com&origbidid=%24%7BORIGBID_ID%7D&pdvid=0&pid=1&plt=5&pn=%24%7BPARTNER_NAME%7D&psz=&pubid=123&purl=www.test.com&rwrd=%24%7BREWARDED%7D&sl=1&slot=%24%7BSLOT_ID%7D&ss=0&tgid=1&tst=" + strconv.FormatInt(startTime, 10),
want: "localhost:8080/wt?adv=&af=&aps=0&au=%24%7BADUNIT%7D&bc=%24%7BBIDDER_CODE%7D&bidid=%24%7BBID_ID%7D&di=&eg=%24%7BG_ECPM%7D&en=%24%7BN_ECPM%7D&fmv=version+1&fskp=1&fsrc=2&ft=1&iid=iid123&kgpv=%24%7BKGPV%7D&orig=www.publisher.com&origbidid=%24%7BORIGBID_ID%7D&pdvid=2&pid=1&plt=5&pn=%24%7BPARTNER_NAME%7D&psz=&pubid=123&purl=www.test.com&rwrd=%24%7BREWARDED%7D&sl=1&slot=%24%7BSLOT_ID%7D&ss=0&tgid=1&tst=" + strconv.FormatInt(startTime, 10),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := GetTrackerInfo(tt.args.rCtx, tt.args.responseExt); got != tt.want {
t.Errorf("GetTrackerInfo() = %v, want %v", got, tt.want)
}
got := GetTrackerInfo(tt.args.rCtx, tt.args.responseExt)
assert.Equal(t, tt.want, got)
})
}
}

0 comments on commit c1e8c4f

Please sign in to comment.