Skip to content

Instantly share code, notes, and snippets.

@loicteixeira
Created November 27, 2021 17:14
Show Gist options
  • Save loicteixeira/6a33ac06b6bea67b457d284a5ffe6f4b to your computer and use it in GitHub Desktop.
Save loicteixeira/6a33ac06b6bea67b457d284a5ffe6f4b to your computer and use it in GitHub Desktop.
Formula1.com cookies consent toggles count
// For https://www.reddit.com/r/formula1/comments/r39q00/formula1com_cookies_are_out_of_control/hm9hqma/?context=8&depth=9
// 1. Navigate to https://www.formula1.com/
// 2. Select "No, Manage Settings"
// 3. Run the following in the developer console
document.querySelectorAll("[class^='categories_']").forEach((el) => {
const sectionTitle = el.querySelector(".categoryTitle").textContent
const companiesCount = el.querySelectorAll("tbody > tr").length / 2 // 2 lines per company
console.log(`${sectionTitle}: ${companiesCount} companies`)
})
document.querySelectorAll("[class^='manageSettings']").forEach((el) => {
const sectionTitle = el.querySelector(".headerTitle").textContent
const consentTogglesCount = el.querySelectorAll(".switchContainerLayerOne").length
const legitimateInterestTogglesCount = el.querySelectorAll(".legintSwitchContainer").length
console.log(`${sectionTitle}: ${consentTogglesCount} consent toggles, ${legitimateInterestTogglesCount} legitimate interest toggles`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment