brave / brave-browser

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

[ads] Optimize resource loading #38505

Closed tmancey closed 5 months ago

tmancey commented 5 months ago

Platforms

all

Description

Only load resources when needed to improve performance

btlechowski commented 2 months ago

Verified with

Brave 1.69.139 Chromium: 127.0.6533.100 (Official Build) beta (64-bit)
Revision 0da988816510c06ff835a14b500d5ab861e18d6e
OS Linux

catalog resource

#### opted into Brave News ads Verified resource is loaded: ``` [2727:2727:0828/002147.036022:VERBOSE1:catalog_url_request.cc(127)] Successfully fetched catalog ``` #### opted into new tab page ads and joined Brave Rewards Verified resource is loaded: ``` [3640:3640:0828/002510.696371:VERBOSE1:catalog_url_request.cc(127)] Successfully fetched catalog ``` #### opted into new tab page ads and new tab page ad events should always be triggered Verified resource is loaded: ``` [3989:3989:0828/002627.096604:VERBOSE1:catalog_url_request.cc(127)] Successfully fetched catalog ``` #### joined Brave Rewards and opted into notification ads Verified resource is loaded: ``` [5975:5975:0828/003238.366800:VERBOSE1:catalog_url_request.cc(127)] Successfully fetched catalog ```

anti-targeting resource

#### opted into Brave News ads Verified resource is loaded: ``` [7485:7485:0828/004345.890378:VERBOSE1:anti_targeting_resource.cc(109)] Successfully loaded and parsed mkdhnfmjhklfnamlheoliekgeohamoig anti-targeting resource version 1 ``` #### opted into new tab page ads and joined Brave Rewards Verified resource is loaded: ``` [8098:8098:0828/004653.336125:VERBOSE1:anti_targeting_resource.cc(109)] Successfully loaded and parsed mkdhnfmjhklfnamlheoliekgeohamoig anti-targeting resource version 1 ``` #### opted into new tab page ads and new tab page ad events should always be triggered Verified resource is loaded: ``` [9024:9024:0828/004956.865685:VERBOSE1:anti_targeting_resource.cc(109)] Successfully loaded and parsed mkdhnfmjhklfnamlheoliekgeohamoig anti-targeting resource version 1 ``` #### joined Brave Rewards and opted into notification ads Verified resource is loaded: ``` [8385:8385:0828/004737.501427:VERBOSE1:anti_targeting_resource.cc(109)] Successfully loaded and parsed mkdhnfmjhklfnamlheoliekgeohamoig anti-targeting resource version 1 ```

purchase intent resource

#### joined Brave Rewards and opted into notification ads ``` [9293:9293:0828/005057.145880:VERBOSE1:purchase_intent_resource.cc(77)] Successfully loaded and parsed bejenkminijgplakmkmcgkhjjnkelbld purchase intent resource version 1 ```

text classification resource

#### joined Brave Rewards and opted into notification ads ``` [10268:10268:0828/005641.305393:VERBOSE1:text_classification_resource.cc(104)] Successfully loaded awdrtoxdlcdyjmckgmtqptnhdtlxgblp neural text classification resource version 1 ```

conversion resource

#### joined Brave Rewards and opted into Brave News ads ``` [11190:11190:0828/010108.061672:VERBOSE1:conversion_resource.cc(82)] Successfully loaded and parsed nnqccijfhvzwyrxpxwjrpmynaiazctqb conversion resource version 1 ``` #### joined Brave Rewards and new tab page ads ``` [11877:11877:0828/010438.292498:VERBOSE1:conversion_resource.cc(82)] Successfully loaded and parsed nnqccijfhvzwyrxpxwjrpmynaiazctqb conversion resource version 1 ``` #### joined Brave Rewards and notification ads ``` [12243:12243:0828/010631.309397:VERBOSE1:conversion_resource.cc(82)] Successfully loaded and parsed nnqccijfhvzwyrxpxwjrpmynaiazctqb conversion resource version 1 ``` #### joined Brave Rewards and search result ads ``` [12532:12532:0828/010735.330852:VERBOSE1:conversion_resource.cc(82)] Successfully loaded and parsed nnqccijfhvzwyrxpxwjrpmynaiazctqb conversion resource version 1 ```

subdivision resource

#### opted into Brave News ads ``` [13677:13677:0828/012811.356727:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [13677:13677:0828/012811.357959:VERBOSE1:subdivision_targeting.cc(166)] Automatically detected PL-02 subdivision ``` #### opted into new tab page ads and has joined Brave Rewards ``` [14413:14413:0828/013114.829226:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [14413:14413:0828/013114.833164:VERBOSE1:subdivision_targeting.cc(108)] Subdivision targeting is unsupported for PL country code ``` #### opted into new tab page ads and new tab page ad events should always be triggered. ``` [15051:15051:0828/013421.047153:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [15051:15051:0828/013421.047602:VERBOSE1:subdivision_targeting.cc(166)] Automatically detected PL-02 subdivision [15051:15051:0828/013421.052909:VERBOSE1:subdivision_targeting.cc(108)] Subdivision targeting is unsupported for PL country code ``` #### joined Brave Rewards and opted into notification ads ``` [14767:14767:0828/013231.803384:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [14767:14767:0828/013231.803454:VERBOSE1:subdivision_targeting.cc(166)] Automatically detected PL-02 subdivision ```

subdivision targeting(US, CA)

#### opted into Brave News ads ``` [16117:16117:0828/013838.243565:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [16117:16117:0828/013838.243730:VERBOSE1:subdivision_targeting.cc(166)] Automatically detected US-NY subdivision ``` #### opted into new tab page ads and has joined Brave Rewards ``` [17207:17207:0828/014126.257374:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision ``` #### opted into new tab page ads and new tab page ad events should always be triggered. ``` [15474:15474:0828/013630.594386:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision [15474:15474:0828/013630.594469:VERBOSE1:subdivision_targeting.cc(166)] Automatically detected US-NY subdivision ``` #### joined Brave Rewards and opted into notification ads ``` [17593:17593:0828/014441.759379:VERBOSE1:subdivision_url_request.cc(109)] Successfully fetched subdivision ```

verifiable conversions

#### Brave News inline ad - rewards ``` [19312:19312:0828/020024.653490:VERBOSE1:redeem_reward_confirmation.cc(75)] Redeem reward confirmation [19312:19312:0828/020024.656654:VERBOSE1:redeem_reward_confirmation.cc(90)] Create reward confirmation [19312:19312:0828/020024.657122:VERBOSE6:redeem_reward_confirmation.cc(95)] URL Request: URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/d77e5c18-f3c0-4689-b286-5ab2b04ffe0f/eyJzaWduYXR1cmUiOiJzVjNobGVBUzRFRVFxMnpLaFcxbUdLdkxiUTBTaDVYVFM0dlE5MitzMWx4bXJ2V3VYU1pLTnF5VWdxaWpjSEcvMXlJVEdNdFdXTlNlQVc3cndtREwydz09IiwidCI6IlV3N25aSmFlS0FZWk1Ec3ZTYTI0L1Q0VkhQTFVJSFlxMnBuSklLdWMyR2F1MDBDOU5xT3NkYlJzbnZ0TmFHd3FGZHFuNmFTT2pCK0ROcDU0Vmkzc1ZnPT0ifQ== Content: {"blindedPaymentTokens":["QN6paVbSJyYT+kplfgttZpX5m02wSwnAkFbCYqZkz2Q="],"buildChannel":"beta","catalog":[{"id":"8fdb249064646ae0d63c53a6ed9f0f0747b46da9"}],"conversion":[{"action":"view"},{"envelope":{"alg":"crypto_box_curve25519xsalsa20poly1305","ciphertext":"DfeiisQXqAUmk9elbHUkcbnee8rVM8W8CUQjd//piwvLfvGBAnm/bSIYG2c/kghu","epk":"VhXPPsFi3QS44cEaJZrC4czWT2sXxit4bwGnRroZNj0=","nonce":"P+jsXNUzOUE1x/uqtlMZ5tm7Ag6aMcns"}}],"createdAtTimestamp":"2024-08-28T00:00:00.000Z","creativeInstanceId":"22110568-4125-4b84-b97a-27ef45c5c07c","platform":"linux","publicKey":"hLaC3RQw5++hx8zaT+47CA8r8cOlAm+ygeky/ci6T1s=","rotatingHash":"6+LhsKOnSn3uWNdMvzw9WpJN/VI5ZJW+Ci2syEuZFjg=","segment":"untargeted","studies":[],"systemTimestamp":"2024-08-28T00:00:00.000Z","transactionId":"d77e5c18-f3c0-4689-b286-5ab2b04ffe0f","type":"conversion","versionNumber":"127.0.6533.100"} Content Type: application/json Method: kPost ``` #### Brave News inline ad - non rewards ``` [18313:18313:0828/015223.152609:VERBOSE1:redeem_non_reward_confirmation.cc(58)] Redeem non-reward confirmation [18313:18313:0828/015223.152989:VERBOSE1:redeem_non_reward_confirmation.cc(67)] Create non-reward confirmation [18313:18313:0828/015223.153162:VERBOSE6:redeem_non_reward_confirmation.cc(72)] URL Request: URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/8c75b24d-ddea-42a9-8283-073771d4f6a6 Content: {"conversion":[{"action":"view"}],"creativeInstanceId":"211a9ff9-48bf-4b79-bd2a-f6b450edac0a","transactionId":"8c75b24d-ddea-42a9-8283-073771d4f6a6","type":"conversion"} Content Type: application/json Method: kPost [18313:18313:0828/015223.153245:VERBOSE7:redeem_non_reward_confirmation.cc(73)] Headers: accept: application/json [18313:18313:0828/015223.383746:VERBOSE6:redeem_non_reward_confirmation.cc(86)] URL Response: URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/8c75b24d-ddea-42a9-8283-073771d4f6a6 Response Status Code: 418 Response: {"id":"8c75b24d-ddea-42a9-8283-073771d4f6a6","payload":{},"type":"conversion","createdAt":"2024-08-27T23:52:23.352Z","modifiedAt":"2024-08-27T23:52:23.352Z","creativeInstanceId":"211a9ff9-48bf-4b79-bd2a-f6b450edac0a"} [18313:18313:0828/015223.384114:VERBOSE7:redeem_non_reward_confirmation.cc(87)] Headers: accept-ranges: bytes access-control-allow-credentials: true cache-control: no-cache content-length: 217 content-security-policy: sandbox content-type: application/json; charset=utf-8 cross-origin-opener-policy: same-origin cross-origin-resource-policy: same-origin date: Tue, 27 Aug 2024 23:52:23 GMT expires: 0 referrer-policy: same-origin strict-transport-security: max-age=31536000; includeSubDomains; preload vary: Origin via: 1.1 varnish x-cache: MISS x-cache-hits: 0 x-content-type-options: nosniff x-frame-options: DENY x-served-by: cache-hel1410031-HEL [18313:18313:0828/015223.384461:VERBOSE1:redeem_non_reward_confirmation.cc(107)] Successfully redeemed non-reward conversion confirmation for inline_content_ad with transaction id 8c75b24d-ddea-42a9-8283-073771d4f6a6 and creative instance id 211a9ff9-48bf-4b79-bd2a-f6b450edac0a ``` #### notification ad ``` [21962:21962:0828/160324.410781:VERBOSE1:redeem_reward_confirmation.cc(75)] Redeem reward confirmation [21962:21962:0828/160324.415337:VERBOSE1:redeem_reward_confirmation.cc(90)] Create reward confirmation [21962:21962:0828/160324.415593:VERBOSE6:redeem_reward_confirmation.cc(95)] URL Request: URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/a592663d-2b5e-4545-a331-91ceb997d236/eyJzaWduYXR1cmUiOiJkZUx3bEFaak1tNGE2SnpDak9IS2hEaDRWRDR6K1NvZEZ2ZjZaanpjMXRwQ0pYY1dyN0c5eEljL0I4Q2t2Y09lNHUxa0RRa2txbGg1UWdtTzFCVkpiUT09IiwidCI6IlFud051cmxINnlkZ2YrdmNPOSs5VVBudGNSYWxhYlZHT3NwckRLajI4eHAxWi9ibjRzT0lNVVFEWEdIUWszb2pYdmdUd0VrQkJ3OUVjdFZyTEJhcEpRPT0ifQ== Content: {"blindedPaymentTokens":["6KMNqvDm07sfmSTqm43M+AGcarU7MXRHRMf1sQB0Gi4="],"buildChannel":"beta","catalog":[{"id":"54f08875ddff0cb5e494d44164efaf2311ed98d1"}],"conversion":[{"action":"view"},{"envelope":{"alg":"crypto_box_curve25519xsalsa20poly1305","ciphertext":"QijXqstwJEPYKozAA+jKxzQu2LuGKr8SJyoX7dDR6XqE+nSxBaaswkKQ1V4MjhWW","epk":"ruyAcf7+lY3HNFJUCjpri9efE6J58vhZMI1HHg6SbWo=","nonce":"Aai1z008JnX+Azo5wZS6VzlTMV0YdXRf"}}],"createdAtTimestamp":"2024-08-28T14:00:00.000Z","creativeInstanceId":"4cda3ae7-1f70-4bca-b361-ca01d6a8f1ed","platform":"linux","publicKey":"hLaC3RQw5++hx8zaT+47CA8r8cOlAm+ygeky/ci6T1s=","rotatingHash":"vgU6mxRYUFyXBboJkWreBDVUcKT6s6pagxijoxA9LIU=","segment":"untargeted","studies":[],"systemTimestamp":"2024-08-28T14:00:00.000Z","transactionId":"a592663d-2b5e-4545-a331-91ceb997d236","type":"conversion","versionNumber":"127.0.6533.100"} Content Type: application/json Method: kPost ``` #### NTT ``` [23092:23092:0828/210702.967679:VERBOSE1:redeem_reward_confirmation.cc(75)] Redeem reward confirmation [23092:23092:0828/210702.970541:VERBOSE1:redeem_reward_confirmation.cc(90)] Create reward confirmation [23092:23092:0828/210702.970954:VERBOSE6:redeem_reward_confirmation.cc(95)] URL Request: URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/0c19ead8-97fc-4066-9ba5-6d9638faa8eb/eyJzaWduYXR1cmUiOiJ3NnlaUFZGakg0MmU5OFpNaWNYbWFxcVk5eXl2YnpIeGNybEU5bVM5L1NjdlpvTGNJQWlORVVuTFYxaUhlTEFTekhYSm1JcjJBNHlFeTNSSmgvWTFYQT09IiwidCI6ImNqTUlYOTBWdk5rSVptSWtTSzdGYWNEYkwzRGpML052NTc5VEJ1eWh6cXRFenJNbHMyelFjNFJ5eThQSkhCSUZZb1Y3bmp2UnZrRW9OK0xOMXIyaDJ3PT0ifQ== Content: {"blindedPaymentTokens":["UlDzwdiUTDWcVTWuV5rAL+95RH+M1wJyRkTxIaE8nEw="],"buildChannel":"beta","catalog":[{"id":"8fdb249064646ae0d63c53a6ed9f0f0747b46da9"}],"conversion":[{"action":"view"},{"envelope":{"alg":"crypto_box_curve25519xsalsa20poly1305","ciphertext":"akFHbq6M3BUu2fqWLHVFJc7YCj7wmOTQvCHON3jehFKSS7D7lXtiERx67Kz3Uvaf","epk":"8oWwR5uF/NXVtXEDgT/XiBwm/KGD/RLnpzYxJeIZPnY=","nonce":"ZyytjBMu6WObuqI1wRC08FMnOovcYRsJ"}}],"createdAtTimestamp":"2024-08-28T19:00:00.000Z","creativeInstanceId":"f7ceed9a-121a-434f-b35a-278edf3a0e09","platform":"linux","publicKey":"hLaC3RQw5++hx8zaT+47CA8r8cOlAm+ygeky/ci6T1s=","rotatingHash":"HF245F1We93lkjtfA/31qnLSYOEEub+dihr4TChf09E=","segment":"untargeted","studies":[],"systemTimestamp":"2024-08-28T19:00:00.000Z","transactionId":"0c19ead8-97fc-4066-9ba5-6d9638faa8eb","type":"conversion","versionNumber":"127.0.6533.100"} Content Type: application/json Method: kPost ```