Skip to content

Commit 41cca4a

Browse files
committed
Fixes reduced delivery of Brave ads campaigns with subdivision targeting
1 parent 51eca1c commit 41cca4a

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/ad_notifications/eligible_ad_notifications.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,17 @@ CreativeAdNotificationList EligibleAds::FilterIneligibleAds(
243243

244244
CreativeAdNotificationList eligible_ads = ads;
245245

246+
eligible_ads = ApplyFrequencyCapping(
247+
eligible_ads,
248+
ShouldCapLastServedAd(creative_ads) ? last_served_ad_ : AdInfo(),
249+
ad_events, browsing_history);
250+
246251
eligible_ads = FilterSeenAdvertisersAndRoundRobinIfNeeded(
247252
eligible_ads, AdType::kAdNotification);
248253

249254
eligible_ads =
250255
FilterSeenAdsAndRoundRobinIfNeeded(eligible_ads, AdType::kAdNotification);
251256

252-
eligible_ads = ApplyFrequencyCapping(
253-
eligible_ads,
254-
ShouldCapLastServedAd(ads) ? last_served_creative_ad_ : CreativeAdInfo(),
255-
ad_events, browsing_history);
256-
257257
eligible_ads = PaceAds(eligible_ads);
258258

259259
eligible_ads = PrioritizeAds(eligible_ads);

vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,17 @@ CreativeInlineContentAdList EligibleAds::FilterIneligibleAds(
254254

255255
CreativeInlineContentAdList eligible_ads = ads;
256256

257+
eligible_ads = ApplyFrequencyCapping(
258+
eligible_ads,
259+
ShouldCapLastServedAd(creative_ads) ? last_served_ad_ : AdInfo(),
260+
ad_events, browsing_history);
261+
257262
eligible_ads = FilterSeenAdvertisersAndRoundRobinIfNeeded(
258263
eligible_ads, AdType::kInlineContentAd);
259264

260265
eligible_ads = FilterSeenAdsAndRoundRobinIfNeeded(eligible_ads,
261266
AdType::kInlineContentAd);
262267

263-
eligible_ads = ApplyFrequencyCapping(
264-
eligible_ads,
265-
ShouldCapLastServedAd(ads) ? last_served_creative_ad_ : CreativeAdInfo(),
266-
ad_events, browsing_history);
267-
268268
eligible_ads = PaceAds(eligible_ads);
269269

270270
eligible_ads = PrioritizeAds(eligible_ads);

vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/round_robin_ads.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010
#include <string>
1111

1212
#include "bat/ads/internal/bundle/creative_ad_info.h"
13-
#include "bat/ads/internal/frequency_capping/exclusion_rules/split_test_frequency_cap.h"
1413

1514
namespace ads {
1615

1716
template <typename T>
1817
T FilterSeenAds(const T& ads, const std::map<std::string, bool>& seen_ads) {
1918
T unseen_ads = ads;
2019

21-
const auto iter = std::remove_if(
22-
unseen_ads.begin(), unseen_ads.end(), [&seen_ads](CreativeAdInfo& ad) {
23-
SplitTestFrequencyCap frequency_cap;
24-
return frequency_cap.ShouldExclude(ad) ||
25-
seen_ads.find(ad.creative_instance_id) != seen_ads.end();
26-
});
20+
const auto iter =
21+
std::remove_if(unseen_ads.begin(), unseen_ads.end(),
22+
[&seen_ads](const CreativeAdInfo& creative_ad) {
23+
return seen_ads.find(creative_ad.creative_instance_id) !=
24+
seen_ads.end();
25+
});
2726

2827
unseen_ads.erase(iter, unseen_ads.end());
2928

vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/round_robin_advertisers.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <string>
1111

1212
#include "bat/ads/internal/bundle/creative_ad_info.h"
13-
#include "bat/ads/internal/frequency_capping/exclusion_rules/split_test_frequency_cap.h"
1413

1514
namespace ads {
1615

@@ -19,14 +18,12 @@ T FilterSeenAdvertisers(const T& ads,
1918
const std::map<std::string, bool>& seen_advertisers) {
2019
T unseen_advertisers = ads;
2120

22-
const auto iter =
23-
std::remove_if(unseen_advertisers.begin(), unseen_advertisers.end(),
24-
[&seen_advertisers](CreativeAdInfo& ad) {
25-
SplitTestFrequencyCap frequency_cap;
26-
return frequency_cap.ShouldExclude(ad) ||
27-
seen_advertisers.find(ad.advertiser_id) !=
28-
seen_advertisers.end();
29-
});
21+
const auto iter = std::remove_if(
22+
unseen_advertisers.begin(), unseen_advertisers.end(),
23+
[&seen_advertisers](const CreativeAdInfo& creative_ad) {
24+
return seen_advertisers.find(creative_ad.advertiser_id) !=
25+
seen_advertisers.end();
26+
});
3027

3128
unseen_advertisers.erase(iter, unseen_advertisers.end());
3229

0 commit comments

Comments
 (0)