-
Notifications
You must be signed in to change notification settings - Fork 904
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
Implement ad conversion attribution for Brave Ads #4253
Conversation
@karenkliu @jenn-rhim Could you please confirm if the design below for "Opt-out of ad conversions" is ok, or if you would like changes: |
@@ -173,6 +174,17 @@ std::unique_ptr<BundleState> Bundle::GenerateFromCatalog( | |||
} | |||
} | |||
|
|||
// Conversions | |||
for (const auto& conversion : creative_set.conversions) { | |||
AdConversionInfo ad_conversion_info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we initialize ad_conversion_info
with copy constructor here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as refactored code to use a single data structure
GetDB().RollbackTransaction(); | ||
return false; | ||
} | ||
|
||
auto categories = bundle_state.categories; | ||
for (std::map<std::string, std::vector<ads::AdInfo>>::iterator it = | ||
categories.begin(); it != categories.end(); ++it) { | ||
for (auto it = categories.begin(); it != categories.end(); ++it) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
is called on every iteration if not optimized by compiler. We can read this value before for-loop and use it in condition evaluation statement. range-based for loops
are even more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
AdConversionInfo::~AdConversionInfo() = default; | ||
|
||
const std::string AdConversionInfo::ToJson() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as std::string is a component of a standard library we can assume it is a built-in type. You should avoid confusing the client programmer and leave off the const when returning a built-in type by value. That technique works good with user-defined types otherwise it creates unneeded confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
eb41207
to
ec08a77
Compare
All passed other than macOS, restarting macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewards code looks good
Fixes brave/brave-browser#6536
Requires: #3980
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
See brave/brave-browser#6536
Reviewer Checklist:
After-merge Checklist:
changes has landed on.