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

[ads] Add search result ad clicked InfoBar #25393

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

aseren
Copy link
Collaborator

@aseren aseren commented Aug 30, 2024

InfoBar on Desktop:
image

InfoBar on iOS:
image

InfoBar on Android:
image

Resolves brave/brave-browser#39625

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

The functionality should be tested for iOS, Android and Desktop

Test case 1

  • Fresh install
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was shown
  • Click Learn more
  • Make sure that Brave Search Result Ad help page is opened
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was not shown for second time

Test case 2

  • Fresh install
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was shown
  • Click a link in the page and navigate to a different page
  • Confirm that the Infobar disappears automatically
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was not shown for second time

Test case 3

  • Fresh install
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was shown
  • Type a new URL in the URL bar and navigate to a page with entered URL
  • Confirm that the Infobar disappears automatically
  • Open staging search search.brave.software in a new tab
  • Trigger search result ad for a staging server with the giraffe request
  • Click search result ad
  • Confirm that Search Result Ad Clicked InfoBar was not shown for second time

@aseren aseren force-pushed the issues/39625 branch 2 times, most recently from f681d88 to 8c14a7c Compare September 4, 2024 00:44
@aseren aseren changed the title [ads] Add Brave Ads privacy notice infobar [ads] Add search result ad clicked InfoBar Sep 4, 2024
@aseren aseren marked this pull request as ready for review September 4, 2024 01:24
@aseren aseren requested review from a team as code owners September 4, 2024 01:24
Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (see comments)

@PrivacyMatters
Copy link

Apologies if I missed a request for review.

I'd suggest we amend the notice slightly to read "Thank you for supporting Brave Search by clicking on a private ad! Unlike Big Tech, we measure ad performance anonymously and preserve your privacy. [Learn more / your opt-out choices]

We needs to link to clear simple info/guidance including choices available and how a user can delete data stored on their device. I know @fmarier has been working on this inc liaising with Brendan

@aseren
Copy link
Collaborator Author

aseren commented Sep 6, 2024

@PrivacyMatters, suggested link page content is available in the spec. Would you able to check if it needs to be changed, please?
Data deletion functionality was implemented here: #24695. Thanks!

@PrivacyMatters
Copy link

@fmarier see #25393 (comment)

@fmarier
Copy link
Member

fmarier commented Sep 6, 2024

@PrivacyMatters, suggested link page content is available in the spec. Would you able to check if it needs to be changed, please?

The text is not finalized yet (I will mention here once ready), but the current version is:

Thank you for supporting Brave Search by clicking on a private ad! Unlike Big Tech, we measure ad performance anonymously and preserve your privacy. [Learn more / opt out choices ]

This PR is also blocked on having a page to link to for the "Learn more" link above. It's coming soon.

Copy link
Contributor

@iefremov iefremov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src lgtm

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings++

Copy link
Collaborator

@ShivanKaul ShivanKaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed text and user experience looks fine (modulo the linked help page actually working)

@PrivacyMatters
Copy link

@fmarier @ShivanKaul if a user deletes the data stored on their device in clicking an ad I assume the next time they click an ad they will see the notice

@aseren
Copy link
Collaborator Author

aseren commented Sep 11, 2024

@fmarier @ShivanKaul if a user deletes the data stored on their device in clicking an ad I assume the next time they click an ad they will see the notice

That's correct. After Brave Ads data deletion, user will get the notice again when they click an ad

addSubview(toastView)
toastView.snp.makeConstraints { make in
make.left.right.height.equalTo(self)
self.animationConstraint = make.top.equalTo(self).offset(SimpleToastUX.toastHeight).constraint
Copy link
Collaborator Author

@aseren aseren Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimpleToastUX.toastHeight is used for an animation constraint, because it is suitable for what we have for dismiss animation in the parent class here: https://github.com/brave/brave-core/blob/master/ios/brave-ios/Sources/Brave/Frontend/Browser/Toast.swift#L84

    UIView.animate(
      withDuration: duration,
      animations: {
        self.animationConstraint?.update(offset: SimpleToastUX.toastHeight)
        self.layoutIfNeeded()
      },
...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're going to have issues with this though since this copy is multiline and will get translated to likely be much taller whereas other toasts typically are capped at a certain height.

Copy link
Collaborator Author

@aseren aseren Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this affects starting/ending Toast heights during animation.
I will try to find a way of animation basing on the actual Toast height, not the predefined constants.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@aseren
Copy link
Collaborator Author

aseren commented Sep 11, 2024

The text is not finalized yet (I will mention here once ready), but the current version is:

Thank you for supporting Brave Search by clicking on a private ad! Unlike Big Tech, we measure ad performance anonymously and preserve your privacy. [Learn more / opt out choices ]

The PR description is updated with screenshots with the new Infobar text.

@aseren aseren force-pushed the issues/39625 branch 2 times, most recently from 8eede73 to b4fe7f6 Compare September 12, 2024 19:48
Copy link
Contributor

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icons stuff LGTM - sorry don't know anything about iOS so I can't provide a more helpful review!

@aseren
Copy link
Collaborator Author

aseren commented Oct 8, 2024

The current PR is blocked by brave/brave-browser#40952: we need brave://ads-internals to be implemented first.

@aseren aseren force-pushed the issues/39625 branch 2 times, most recently from 5869709 to 9a6c7c6 Compare November 15, 2024 20:18
constexpr int kIconSize = 20;

constexpr char kLearnMoreUrl[] =
"https://support.brave.com/hc/en-us/articles/360026361072-Brave-Ads-FAQ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to point to https://search.brave.com/help/conversion-reporting once it's live.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

static let toastCloseButtonWidth: CGFloat = 20.0
static let toastLabelFont = UIFont.preferredFont(forTextStyle: .subheadline)
static let toastBackgroundColor = UIColor(braveSystemName: .schemesOnPrimaryFixed)
static let learnMoreUrl = "https://support.brave.com/hc/en-us/articles/360026361072-Brave-Ads-FAQ"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@fmarier
Copy link
Member

fmarier commented Nov 15, 2024

There is another aspect to add the to test plan here:

  1. Clear profile (to reset the new pref)
  2. Visit Brave Search again and click on the ad
  3. Confirm the infobar is present but don't touch it.
  4. Click a link in the page and navigate to a different page.
  5. Confirm that the infobar disappears automatically.
  6. Repeat steps 1-5 but in Step 4 instead of clicking a link, type a new URL in the URL bar. That direct navigation should also make the infobar go away automatically.

@aseren
Copy link
Collaborator Author

aseren commented Nov 20, 2024

There is another aspect to add the to test plan here:

  1. Clear profile (to reset the new pref)
  2. Visit Brave Search again and click on the ad
  3. Confirm the infobar is present but don't touch it.
  4. Click a link in the page and navigate to a different page.
  5. Confirm that the infobar disappears automatically.
  6. Repeat steps 1-5 but in Step 4 instead of clicking a link, type a new URL in the URL bar. That direct navigation should also make the infobar go away automatically.

Added 👍

@aseren aseren requested review from fmarier and bridiver November 20, 2024 01:55
@@ -585,6 +585,7 @@ brave_chrome_browser_ui_allow_circular_includes_from +=
brave_chrome_browser_allow_circular_includes_from = [
"//brave/browser/ui",
"//brave/browser/brave_ads:impl",
"//brave/browser/brave_ads/creatives/search_result_ad",
Copy link
Collaborator Author

@aseren aseren Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowed a circular dependency from search_result_ad target.

cc @bridiver

Comment on lines 51 to 52
CreateConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate>(
new CreativeSearchResultAdClickedInfoBarDelegate())));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use std::make_unique?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

Copy link
Collaborator

@cdesouza-chromium cdesouza-chromium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ads] Infobar/notice for first interaction with clicked SERP ad landing page
10 participants