Skip to content

Commit

Permalink
Merge pull request #14106 from /issues/23975
Browse files Browse the repository at this point in the history
Improve Brave Ads logging for frequency capping
  • Loading branch information
tmancey authored Jul 11, 2022
2 parents d86a3b0 + bd28df4 commit ef7f84c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "bat/ads/internal/account/account.h"
#include "bat/ads/internal/ads/ad_events/inline_content_ads/inline_content_ad_event_handler.h"
#include "bat/ads/internal/ads/serving/inline_content_ad_serving.h"
#include "bat/ads/internal/base/logging_util.h"
#include "bat/ads/internal/deprecated/client/client_state_manager.h"
#include "bat/ads/internal/geographic/subdivision/subdivision_targeting.h"
#include "bat/ads/internal/history/history_manager.h"
Expand Down Expand Up @@ -60,6 +61,11 @@ void InlineContentAd::TriggerEvent(

///////////////////////////////////////////////////////////////////////////////

void InlineContentAd::OnOpportunityAroseToServeInlineContentAd(
const SegmentList& segments) {
BLOG(1, "Opportunity arose to serve an inline content ad");
}

void InlineContentAd::OnDidServeInlineContentAd(const InlineContentAdInfo& ad) {
TriggerEvent(ad.placement_id, ad.creative_instance_id,
mojom::InlineContentAdEventType::kServed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class InlineContentAd final : public inline_content_ads::EventHandlerObserver,

private:
// inline_content_ads::ServingObserver:
void OnOpportunityAroseToServeInlineContentAd(
const SegmentList& segments) override;
void OnDidServeInlineContentAd(const InlineContentAdInfo& ad) override;

// inline_content_ads::EventHandlerObserver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "bat/ads/internal/account/account.h"
#include "bat/ads/internal/ads/ad_events/new_tab_page_ads/new_tab_page_ad_event_handler.h"
#include "bat/ads/internal/ads/serving/new_tab_page_ad_serving.h"
#include "bat/ads/internal/base/logging_util.h"
#include "bat/ads/internal/deprecated/client/client_state_manager.h"
#include "bat/ads/internal/geographic/subdivision/subdivision_targeting.h"
#include "bat/ads/internal/history/history_manager.h"
Expand Down Expand Up @@ -55,6 +56,11 @@ void NewTabPageAd::TriggerEvent(const std::string& placement_id,

///////////////////////////////////////////////////////////////////////////////

void NewTabPageAd::OnOpportunityAroseToServeNewTabPageAd(
const SegmentList& segments) {
BLOG(1, "Opportunity arose to serve a new tab page ad");
}

void NewTabPageAd::OnDidServeNewTabPageAd(const NewTabPageAdInfo& ad) {
TriggerEvent(ad.placement_id, ad.creative_instance_id,
mojom::NewTabPageAdEventType::kServed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class NewTabPageAd final : public new_tab_page_ads::EventHandlerObserver,

private:
// new_tab_page_ads::ServingObserver:
void OnOpportunityAroseToServeNewTabPageAd(
const SegmentList& segments) override;
void OnDidServeNewTabPageAd(const NewTabPageAdInfo& ad) override;

// new_tab_page_ads::EventHandlerObserver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ void NotificationAd::OnUserDidBecomeActive(const base::TimeDelta idle_time,

void NotificationAd::OnOpportunityAroseToServeNotificationAd(
const SegmentList& segments) {
BLOG(1, "Opportunity arose to serve a notification ad");

privacy::p2a::RecordAdOpportunityForSegments(AdType::kNotificationAd,
segments);
}
Expand Down

0 comments on commit ef7f84c

Please sign in to comment.