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

Privacy 2024 - Implement CCPA link metric #119

Merged
merged 7 commits into from
Jun 10, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion dist/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,72 @@ return JSON.stringify({
navigator_geolocation_watchPosition: testPropertyStringInResponseBodies(
'navigator.+geolocation.+watchPosition'
),
}
},

ccpa_link: (() => {
const allowedCCPALinkPhrases = [
//https://petsymposium.org/popets/2022/popets-2022-0030.pdf page 612
'do not sell my personal information',
'do not sell my information',
'do not sell my info',
'do not sell my personal info',
'do not sell or share my personal information',
'do not sell or share my information',
'do not sell or share my info',
'do not sell or share my personal info',
//https://cppa.ca.gov/faq.html
'your privacy choices',
'your california privacy choices'
]

// https://petsymposium.org/popets/2022/popets-2022-0030.pdf page 627
const CCPAExclusionPhrases = [
'terms',
'user agreement',
'service agreement',
'conditions of use',
'terms of usage',
'privacy notice',
'privacy policy',
'privacy & cookies',
'preferences',
'terms of sale',
'login',
'terms and conditions apply',
'accessibility',
'your data in search',
'shield',
'promo',
'campaign',
'deal',
'ad choice',
max-ostapenko marked this conversation as resolved.
Show resolved Hide resolved
'january',
'february',
'march',
'april',
'may',
'june',
'july',
'august',
'september',
'october',
'november',
'december',
'archive',
'previous',
'versions',
'settings'
]

const CCPALinks = Array.from(document.querySelectorAll('a')).filter(link => {
const text = link.textContent.toLowerCase()
return allowedCCPALinkPhrases.some(phrase => text.includes(phrase)) && !CCPAExclusionPhrases.some(phrase => text.includes(phrase))
})

return {
hasCCPALink: CCPALinks.length > 0,
CCPALinkPhrases: CCPALinks.map(link => link.textContent.trim().toLowerCase())
}
})()

});