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

State level ads delivery #9200

Closed
jsecretan opened this issue Apr 14, 2020 · 4 comments · Fixed by brave/brave-core#5602
Closed

State level ads delivery #9200

jsecretan opened this issue Apr 14, 2020 · 4 comments · Fixed by brave/brave-core#5602

Comments

@jsecretan
Copy link

jsecretan commented Apr 14, 2020

Description

Some advertisers need to run their campaigns in specific states/provinces, either because what they are advertising is of regional interest, or because they are not allowed to sell items in specific states. After some extensive privacy analysis, we have determined we can run campaigns at state level in the United States, for most states (excluding Wyoming and territories for now) while keeping a very high anonymity set (k=1000).

Determining Location

Upon sign up for Brave Ads, and on exponentially random 24 hour time periods thereafter, the browser should call out to https://ads-serve.brave.com/v5/getstate and store the state and country code provided in its local store, example

{ “country_code”: “US”, “state_province_code”: “FL” }

Values will only be returned for either if it is in the given list provided in the above section. Otherwise, the value will be an empty string “”.

Ad Catalog Changes

The browser will read the new version of the catalog at /v5/catalog. This new version of the catalog will allow additional state levels in certain cases. If multiple targets are listed, the catalog will be eligible for any of the given geo-targets. Campaigns with specific geo-targeting defined will only be eligible to serve if the client has successfully defined a value for state and it matches.

`"geoTargets": [
{
"code": "US-FL",
"name": "United States-Florida"
}

]
`

New Settings

For browsers in the US, Brave Ads settings should have the ability to choose state, including the full list of 50 states. There should also be a setting for “Do not use state to determine ads”, which would result in no state level campaigns. Once a state is specifically set, it should not be updated by state endpoint.

@tmancey tmancey removed their assignment May 16, 2020
@moritzhaller moritzhaller self-assigned this May 19, 2020
@tmancey tmancey added priority/P3 The next thing for us to work on. It'll ride the trains. enhancement QA/Yes release-notes/include labels May 20, 2020
@cwmke
Copy link

cwmke commented May 21, 2020

Would it be possible to set at the city or county level as well? I occasionally get some ads for Chicago Cubs gear despite living in a different city. This is most likely caused by my use of a VPN.

@jsecretan
Copy link
Author

Not just yet @cwmke, we did a privacy analysis and right now, state is all we are comfortable with to keep large anonymity sets. But hopefully in the not too distant future as Brave grows.

@LaurenWags
Copy link
Member

LaurenWags commented Aug 5, 2020

Verified passed using

Brave | 1.12.107 Chromium: 84.0.4147.105 (Official Build) (64-bit)
-- | --
Revision | a6b12dfad6663f13a7e16e9a42a6a4975374096b-refs/branch-heads/4147@{#943}
OS | macOS Version 10.14.6 (Build 18G3020)
[13069:775:0805/104020.477595:VERBOSE1:subdivision_targeting.cc(73)] Ads subdivision targeting is not supported for en-CA locale
  • Confirmed in UI that state selection is not possible if locale is not US

Screen Shot 2020-08-05 at 10 43 05 AM

  • Confirmed when locale is US, I see below in the logs:
[13142:775:0805/104354.180029:VERBOSE1:subdivision_targeting.cc(94)] Automatically detecting ads subdivision
[13142:775:0805/104354.180093:VERBOSE1:subdivision_targeting.cc(144)] Fetch ads subdivision
[13142:775:0805/104354.180176:VERBOSE2:subdivision_targeting.cc(145)] GET /v5/getstate
[13142:775:0805/104354.180351:VERBOSE5:subdivision_targeting.cc(150)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Method: GET
[13142:775:0805/104354.593619:VERBOSE6:subdivision_targeting.cc(160)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Response Status Code: 200
[13142:775:0805/104354.595259:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision in 13 hours, 30 minutes, 53 seconds at 12:14 AM
  • Confirmed subdivision fetch is scheduled (debug mode):
[13394:775:0805/111434.358035:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision in 0 hours, 2 minutes, 20 seconds at 11:16 AM
  • Confirmed if I select Disable in the drop down, logs reflect this. Confirmed this selection is retained on restart and not updated automatically.
[13142:775:0805/110556.374165:VERBOSE1:subdivision_targeting.cc(80)] Ads subdivision targeting is disabled
  • Confirmed if I manually select a state in the drop down, logs reflect this. Confirmed this selection is retained on restart and not updated automatically.
[13142:775:0805/110647.258933:VERBOSE1:subdivision_targeting.cc(89)] Ads subdivision targeting is enabled for US-AR
  • Confirmed subdivision fetch retry. Initial attempt:
[13436:775:0805/113201.081991:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[13436:775:0805/113201.082480:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 0 minutes, 42 seconds at 11:32 AM

Second attempt:

[13436:775:0805/113243.113186:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[13436:775:0805/113243.113501:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 2 minutes, 21 seconds at 11:35 AM

Third attempt:

[13436:775:0805/113504.144310:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[13436:775:0805/113504.144522:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 8 minutes, 48 seconds at 11:43 AM
  • Confirmed subdivision targeting is auto-detected by default on a fresh install

  • Confirmed subdivision targeting is auto-detected by default on upgrade (when ads enabled) from 1.11.x as well.

  • Confirmed subdivision targeting messages do not appear in the logs if ads were disabled on 1.11.x prior to upgrade. Confirmed enabling Ads does fetch subdivision after upgrade.

  • Additional test plan provided by @jsecretan was confirmed. See me for details.


Verification passed on

Brave 1.12.108 Chromium: 84.0.4147.105 (Official Build) (64-bit)
Revision a6b12dfad6663f13a7e16e9a42a6a4975374096b-refs/branch-heads/4147@{#943}
OS Ubuntu 18.04 LTS
[6329:6329:0810/150232.876474:VERBOSE1:subdivision_targeting.cc(73)] Ads subdivision targeting is not supported for pl_PL.UTF-8 locale
  • Confirmed in UI that state selection is not possible if locale is not US
    image

  • Confirmed when locale is US, I see below in the logs:

[6766:6766:0810/150523.463123:VERBOSE1:subdivision_targeting.cc(94)] Automatically detecting ads subdivision
[6766:6766:0810/150523.463267:VERBOSE1:subdivision_targeting.cc(144)] Fetch ads subdivision
[6766:6766:0810/150523.463291:VERBOSE2:subdivision_targeting.cc(145)] GET /v5/getstate
[6766:6766:0810/150523.463327:VERBOSE5:subdivision_targeting.cc(150)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Method: GET
[6766:6766:0810/150526.391055:VERBOSE6:subdivision_targeting.cc(160)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Response Status Code: 200
[7693:7693:0810/151019.995337:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision on Tuesday, August 11, 2020 at 4:04:10 PM
  • Confirmed subdivision fetch is scheduled (debug mode):
[8333:8333:0810/151843.149676:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision in 0 hours, 6 minutes, 57 seconds at 3:25 PM
  • Confirmed if I select Disable in the drop down, logs reflect this. Confirmed this selection is retained on restart and not updated automatically.
[8333:8333:0810/151958.186253:VERBOSE1:subdivision_targeting.cc(80)] Ads subdivision targeting is disabled
  • Confirmed if I manually select a state in the drop down, logs reflect this. Confirmed this selection is retained on restart and not updated automatically.
[8333:8333:0810/152058.477137:VERBOSE1:subdivision_targeting.cc(89)] Ads subdivision targeting is enabled for US-AL
  • Confirmed subdivision fetch retry. Initial attempt:
[8787:8787:0810/155005.730157:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 1 minute, 42 seconds at 3:51 PM

Second attempt:

[8787:8787:0810/155147.736321:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 2 minutes, 32 seconds at 3:54 PM

Third attempt:

[8787:8787:0810/155419.742003:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 1 minute, 19 seconds at 3:55 
  • Confirmed subdivision targeting is auto-detected by default on a fresh install

  • Confirmed subdivision targeting is auto-detected by default on upgrade (when ads enabled) from 1.11.x as well.

  • Confirmed subdivision targeting messages do not appear in the logs if ads were disabled on 1.11.x prior to upgrade. Confirmed enabling Ads does fetch subdivision after upgrade.

  • Additional test plan provided by @jsecretan was confirmed.


Verification is in progress

Brave | 1.12.108 Chromium: 84.0.4147.105 (Official Build) (64-bit)
-- | --
Revision | a6b12dfad6663f13a7e16e9a42a6a4975374096b-refs/branch-heads/4147@{#943}
OS | Windows 10 OS Version 1903 (Build 18362.959)
[14072:14068:0811/124318.023:VERBOSE1:subdivision_targeting.cc(73)] Ads subdivision targeting is not supported for en-CA locale

  • Confirmed in UI that state selection is not possible if locale is not US
    image

  • Confirmed when locale is US, I see below in the logs:

[10764:16392:0811/131100.507:VERBOSE1:subdivision_targeting.cc(94)] Automatically detecting ads subdivision
[10764:16392:0811/131100.507:VERBOSE1:subdivision_targeting.cc(144)] Fetch ads subdivision
[10764:16392:0811/131100.508:VERBOSE2:subdivision_targeting.cc(145)] GET /v5/getstate
[10764:16392:0811/131100.508:VERBOSE5:subdivision_targeting.cc(150)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Method: GET
[10764:16392:0811/131101.767:VERBOSE6:subdivision_targeting.cc(160)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v5/getstate
  Response Status Code: 200
[10764:16392:0811/131101.768:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision in 2 hours, 27 minutes, 50 seconds at 3:38 PM
  • Confirmed subdivision fetch is scheduled (debug mode):
[4636:8100:0811/132452.756:VERBOSE1:subdivision_targeting.cc(247)] Fetch ads subdivision in 0 hours, 12 minutes, 18 seconds at 1:37 PM
  • Confirmed if I select Disable in the drop down, logs reflect this. Confirmed this selection is retained on restart and not updated automatically.
[4636:8100:0811/133532.181:VERBOSE1:subdivision_targeting.cc(80)] Ads subdivision targeting is disabled
[16268:12172:0811/134300.210:VERBOSE1:subdivision_targeting.cc(89)] Ads subdivision targeting is enabled for US-CA
  • Confirmed subdivision fetch retry. Initial attempt:
[6332:2568:0811/135905.857:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[6332:2568:0811/135905.857:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 1 minute, 17 seconds at 2:00 PM

Second attempt:

[18408:16220:0811/140128.727:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[18408:16220:0811/140128.727:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 1 minute, 35 seconds at 2:03 PM

Third attempt:

[17952:4112:0811/140330.207:VERBOSE1:subdivision_targeting.cc(176)] Failed to fetch ads subdivision
[17952:4112:0811/140330.207:VERBOSE1:subdivision_targeting.cc(237)] Retry fetching ads subdivision in 0 hours, 0 minutes, 53 seconds at 2:04 PM
  • Confirmed subdivision targeting is auto-detected by default on a fresh install

  • Confirmed subdivision targeting is auto-detected by default on upgrade (when ads enabled) from 1.11.x as well.

  • Confirmed subdivision targeting messages do not appear in the logs if ads were disabled on 1.11.x prior to upgrade. Confirmed enabling Ads does fetch subdivision after upgrade.

  • Additional test plan provided by @jsecretan was confirmed.

  • Verified state-level ads are shown for Oregon
    image

  • Verified state-level ads are shown for Florida
    image

  • Verified other scenarios provided by @jsecretan and confirmed which are working as expected

@srirambv
Copy link
Contributor

Verification passed on OnePlus 6T with Android 10 running 1.12.112 x64 build

  • Verified test plan from Implement state level ads delivery brave-core#5602

  • Verified for non-US locale logs shows not supported message
    image

  • Verified for non-US locale there is no dropdown list for states

  • Verified when locale is set to US the following logs are shown
    image
    image

  • Verified able to manually select state via UI from the dropdown list.

  • Verified scheduled subdivision fetch is caputed in logs (non-debug mode):
    image

  • Scheduled subdivision fetch in debug mode: Not verified

  • Verified when state selection is set to Disable logs reflect this. Verified restarting browser doesn't reset it to automatic automatically.
    image

  • Verified selecting a state manually from UI logs capture it correctly. Verified restarting browser doesn't reset it to automatic
    image

  • Verified subdivision fetch retry is logged:

    • First attempt
      image

    • Second attempt:
      image

  • Verified subdivision targeting is auto-detected by default on a fresh install
    image

  • Verified subdivision targeting is auto-detected on upgrade from 1.11.105

  • Verified when ads disabled on 1.11.105 and upgrading to 1.12.x, subdivision targeting messages do not appear in the logs. Verified enabling ads automatically starts logging the info

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

Successfully merging a pull request may close this issue.

8 participants