Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agma: Allow app.bundle to be used as selector for apps #3780

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions analytics/agma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ analytics:
# Required: set the accounts you want to track
accounts:
- code: "my-code" # Required: provied by agma
publisher_id: "123" # Required: Exchange specific publisher_id
site_app_id: "openrtb2-site.id-or-app.id" # optional: scope to the publisher with an openrtb2 Site object id or App object id
publisher_id: "123" # Required: Exchange specific publisher_id, can be an empty string accounts are not used
site_app_id: "openrtb2-site.id-or-app.id-or-app.bundle" # optional: scope to the publisher with an openrtb2 Site object id or App object id/bundle
# Optional properties (advanced configuration)
endpoint:
url: "https://go.pbs.agma-analytics.de/v1/prebid-server" # Check with agma if your site needs an extra url
Expand Down
4 changes: 4 additions & 0 deletions analytics/agma/agma_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func (l *AgmaLogger) extractPublisherAndSite(requestWrapper *openrtb_ext.Request
publisherId = requestWrapper.App.Publisher.ID
}
appSiteId = requestWrapper.App.ID
if appSiteId == "" {
appSiteId = requestWrapper.App.Bundle
}

}
return publisherId, appSiteId
}
Expand Down
35 changes: 35 additions & 0 deletions analytics/agma/agma_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ func TestShouldTrackEvent(t *testing.T) {
PublisherId: "track-me",
Code: "abc",
},
{
PublisherId: "",
SiteAppId: "track-me",
Code: "abc",
},
},
}
mockedSender := new(MockedSender)
Expand Down Expand Up @@ -283,6 +288,36 @@ func TestShouldTrackEvent(t *testing.T) {

assert.False(t, shouldTrack)
assert.Equal(t, "", code)

// should allow empty accounts
shouldTrack, code = logger.shouldTrackEvent(&openrtb_ext.RequestWrapper{
BidRequest: &openrtb2.BidRequest{
App: &openrtb2.App{
ID: "track-me",
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
},
},
})

assert.True(t, shouldTrack)
assert.Equal(t, "abc", code)

// Bundle ID instead of app.id
shouldTrack, code = logger.shouldTrackEvent(&openrtb_ext.RequestWrapper{
BidRequest: &openrtb2.BidRequest{
App: &openrtb2.App{
Bundle: "track-me",
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
},
},
})

assert.True(t, shouldTrack)
assert.Equal(t, "abc", code)
}

func TestShouldTrackMultipleAccounts(t *testing.T) {
Expand Down
Loading