Blocking Tracking JavaScript at the Function Granularity
Abdul Haddi Amjad, Shaoor Munir, Zubair Shafiq, Muhammad Ali Gulzar
Abstract
Modern websites extensively rely on JavaScript to implement both functionality and tracking. Existing privacy-enhancing content blocking tools struggle against mixed scripts, which simultaneously implement both functionality and tracking, because blocking the script would break functionality and not blocking it would allow tracking. We propose NoT.js, a fine-grained JavaScript blocking tool that operates at the function-level granularity. NoT.js's strengths lie in analyzing the dynamic execution context, including the call stack and calling context of each JavaScript function, and then encoding this context to build a rich graph representation. NoT.js trains a supervised machine learning classifier on a webpage's graph representation to first detect tracking at the JavaScript function-level and then automatically generate surrogate scripts that preserve functionality while removing tracking. Our evaluation of NoT.js on the top-10K websites demonstrates that it achieves high precision (94%) and recall (98%) in detecting tracking JavaScript functions, outperforming the state-of-the-art while being robust against offthe-shelf JavaScript obfuscation. Fine-grained detection of tracking functions allows NoT.js to automatically generate surrogate scripts that remove tracking JavaScript functions without causing major breakage. Our deployment of NoT.js shows that mixed scripts are present on 62.3% of the top-10K websites, with 70.6% of the mixed scripts being third-party that engage in tracking activities such as cookie ghostwriting. We share a sample of the tracking functions detected by NoT.js within mixed scripts-not currently on filter lists-with filter list authors, who confirm that these scripts are not blocked due to potential functionality breakage, despite being known to implement tracking.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 7e4dfdfa-184f-4f76-a876-b16cb929c253Cited by top-tier papers4
- SoK: After Decades of Web Tracker Detection, What's Next?Wolf Rieder, Philip Raschke, Thomas Cory, Christian René Sechting et al.S&P 2026 · 1 citation
- Accessibility Issues in Ad-Driven Web ApplicationsAbdul Haddi Amjad, Muhammad Danish, Bless Jah, Muhammad Ali GulzarICSE 2025 · 1 citation
- Byte by Byte: Unmasking Browser Fingerprinting at the Function Level using V8 Bytecode TransformersPouneh Nikkhah Bahrami, Dylan Cutler, Igor BilogrevicCCS 2025
- Users Pay Twice: The Hidden Energy Cost of Web AdvertisingSamuel Pélissier, Naif Mehanna, Sterenn Roux, Quentin Perez et al.WWW 2026
Builds on11
- Tranco: A Research-Oriented Top Sites Ranking Hardened Against ManipulationVictor Le Pochat, Tom van Goethem, Samaneh Tajalizadehkhoob, Maciej Korczynski et al.NDSS 2019 · 826 citations
- AdGraph: A Graph-Based Approach to Ad and Tracker BlockingUmar Iqbal, Peter Snyder, Shitong Zhu, Benjamin Livshits et al.S&P 2020 · 112 citations
- Cookie Swap Party: Abusing First-Party Cookies for Web TrackingQuan Chen, Panagiotis Ilia, Michalis Polychronakis, Alexandros KapravelosWWW 2021 · 57 citations
- Journey to the Center of the Cookie Ecosystem: Unraveling Actors' Roles and RelationshipsIskander Sánchez-Rola, Matteo Dell'Amico, Davide Balzarotti, Pierre-Antoine Vervier et al.S&P 2022 · 35 citations
- Detecting Filter List Evasion with Event-Loop-Turn Granularity JavaScript SignaturesQuan Chen, Peter Snyder, Ben Livshits, Alexandros KapravelosS&P 2021 · 33 citations
Related papers
- ASTrack: Automatic Detection and Removal of Web Tracking Code with Minimal Functionality LossIsmael Castell-Uroz, Kensuke Fukuda, Pere Barlet-RosINFOCOM 2023 · 8 citations
- Duumviri: Detecting Trackers and Mixed Trackers with a Breakage DetectorHe Shuang, Lianying Zhao, David LieNDSS 2025
- Measuring and Disrupting Anti-Adblockers Using Differential Execution AnalysisShitong Zhu, Xunchao Hu, Zhiyun Qian, Zubair Shafiq et al.NDSS 2018 · 44 citations
- AdVersa: Adversarially-Robust and Practical Ad and Tracker Blocking in the WildChaejin Lim, Kiho Lee, Beomjin Jin, Heewon Baek et al.WWW 2026
- AdCPG: Classifying JavaScript Code Property Graphs with Explanations for Ad and Tracker BlockingChangmin Lee, Sooel SonCCS 2023 · 7 citations
