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 2 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
67 changes: 67 additions & 0 deletions dist/ccpa-link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//[ccpa-link]
// Uncomment the previous line for testing on webpagetest.org


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',
max-ostapenko marked this conversation as resolved.
Show resolved Hide resolved
'privacy policy',
'privacy & cookies',
'preferences',
'terms of sale',
'login',
'terms and conditions apply',
'accessibility',
'your data in search',
'shield',
'promo',
'campaign',
'deal',
'ad choice',
'january',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the case that we need to check for month names excluded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comes from this paper: https://petsymposium.org/popets/2022/popets-2022-0030.pdf. They ran a test crawl and then manually checked the results, so all of the exclusion phrases caused a false positive on at least one site. I don't think they identify which sites though.

'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 JSON.stringify({
hasCCPALink: CCPALinks.length > 0,
CCPALinkPhrases: CCPALinks.map(link => link.textContent.trim().toLowerCase())
})