brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.52k stars 2.27k forks source link

Add Brave Ads status header to search.brave.com calls #25430

Closed jsecretan closed 1 year ago

jsecretan commented 1 year ago

Description

In preparation for Brave Ads on Brave Search, it is helpful for the Brave Search backend to understand whether the requesting browser has Brave Ads enabled. As such we should add the header X-Brave-Ads-Enabled: 1 to any call to Brave Search (and it's associated dev/staging environments) whether originating from the main search box or the Omnibox.

This can hopefully use some of the same mechanisms that have been used in the past on this, e.g. https://github.com/brave/brave-browser/wiki/Custom-Headers. When the work is complete, please add an appropriate description to this page: https://github.com/brave/brave-browser/wiki/Custom-Headers.

btlechowski commented 1 year ago

Verification passed on

Brave 1.46.83 Chromium: 107.0.5304.68 (Official Build) beta (64-bit)
Revision a4e93e89d3b3df1be22214603fba846ad0183ca5-refs/branch-heads/5304@{#991}
OS Ubuntu 18.04 LTS

Verified test plan from https://github.com/brave/brave-core/pull/15147

https://search.brave.com/

Clean profile

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/201784671-c551ffa5-3956-465e-b1ff-4b8b385addc2.png)

Ads enabled

`X-Brave-Ads-Enabled: 1` is included in the request ![image](https://user-images.githubusercontent.com/34715963/201785269-a69a7ebd-46aa-4d05-b2dd-bbbb41fb3377.png)

Ads disabled

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/201785415-911c8bc7-7930-450c-9dd6-111f2add9faf.png)
LaurenWags commented 1 year ago

Removing QA Pass-Linux as this is being uplifted to 1.45.x where it will need to be retested. In the event that there is not another 1.45.x build, the label can be re-added.

LaurenWags commented 1 year ago

Requires 1.45.129 or higher to test.

btlechowski commented 1 year ago

Verification passed on

Brave 1.45.129 Chromium: 107.0.5304.110 (Official Build) (64-bit)
Revision 2a558545ab7e6fb8177002bf44d4fc1717cb2998-refs/branch-heads/5304@{#1202}
OS Ubuntu 18.04 LTS

Verified test plan from https://github.com/brave/brave-core/pull/15147

https://search.brave.com/

Clean profile

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202472247-1b164595-e5f1-46eb-aa21-03958569d7f9.png)

Ads enabled

`X-Brave-Ads-Enabled: 1` is included in the request ![image](https://user-images.githubusercontent.com/34715963/202472530-100ae72a-f455-4ea3-a63b-07f05bb01412.png)

Ads disabled

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202472751-1c29cf45-8a92-4c03-825e-6479b89969a9.png)

Ads enabled - Private window

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202505791-6338e986-aae8-4ce4-bc89-2d612c4bdf3a.png)

https://search.brave.software/

Clean profile

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202473998-06e1d9d8-56f8-4611-9136-d9bb60a91dd1.png)

Ads enabled

`X-Brave-Ads-Enabled: 1` is included in the request ![image](https://user-images.githubusercontent.com/34715963/202474218-ddde3eab-7b7f-4eb9-bbe1-56054b1bfe18.png)

Ads disabled

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202474348-f87b361b-678f-42a3-b81e-7ce937179762.png)

Verification passed on

Brave 1.45.129 Chromium: 107.0.5304.110 (Official Build) (64-bit)
Revision 2a558545ab7e6fb8177002bf44d4fc1717cb2998-refs/branch-heads/5304@{#1202}
OS Windows 10 Version 21H2 (Build 19044.2251)

Verified test plan from https://github.com/brave/brave-core/pull/15147

https://search.brave.com/

Clean profile

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202481464-da55c248-60a3-4434-b392-71c9741dfba3.png)

Ads enabled

`X-Brave-Ads-Enabled: 1` is included in the request ![image](https://user-images.githubusercontent.com/34715963/202481712-91d01303-ec1f-421b-96e4-70b6c76989ec.png)

Ads disabled

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202481987-e247722a-059f-4a10-83cb-6be452cc3737.png)
btlechowski commented 1 year ago

Verification passed on Brave v1.45.129 on Samsung Galaxy Tab S5e (Android 11.0)

Verified test plan from https://github.com/brave/brave-core/pull/15147

https://search.brave.com/

Clean profile

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202492636-d53e7e9c-5eec-4fba-9dbe-97a555470a10.png)

Ads enabled

`X-Brave-Ads-Enabled: 1` is included in the request ![image](https://user-images.githubusercontent.com/34715963/202492725-60b02d80-1032-4176-8f33-843f4466e371.png)

Ads disabled

`X-Brave-Ads-Enabled: 1` is not included in the request ![image](https://user-images.githubusercontent.com/34715963/202493212-bbed71d8-979c-42ea-b3c9-289c5f3e7e65.png)
Uni-verse commented 1 year ago

Verified on Samsung Galaxy S21 using the following build(s):

Brave   1.45.131 Chromium: 107.0.5304.110 (Official Build) (64-bit) 
Revision    2a558545ab7e6fb8177002bf44d4fc1717cb2998-refs/branch-heads/5304@{#1202}
OS  Android 12; Build/SP1A.210812.016

Clean profile

x-brave-ads-enabled: 1 is not appended to the header

Screen Shot 2022-11-22 at 11 41 57 AM

Ads Enabled

x-brave-ads-enabled: 1 is appended to the header

Screen Shot 2022-11-22 at 11 43 06 AM

Ads Disabled

Screen Shot 2022-11-22 at 11 47 55 AM