Full text
Tracking the trackers: An analysis of third-party data collection through website consent managers Master Thesis submitted to the Faculty of the Escola T`ecnica d’Enginyeria de Telecomunicaci´o de Barcelona Universitat Polit`ecnica de Catalunya by Rodrigo Cabezas Quir´os In partial fulfillment of the requirements for the MASTER IN CYBERSECURITY Advisor: Pere Barlet Ros Co-Advisor: Ismael Castell-Uroz Barcelona, August 2024
Contents List of Figures 4 List of Tables 5 1 Introduction 8 1.1 Statementofpurpose.............................. 9 1.2 Requirements and specifications . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3 Methods and procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 Workplan.................................... 10 1.4.1 Tasksdescription............................ 10 1.4.2 GanttDiagram ............................. 11 1.5 Deviations from the original plan . . . . . . . . . . . . . . . . . . . . . . . 11 2 State of the art 13 2.1 GDPR...................................... 13 2.2 Consent Management Platforms . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3 Transparency and consent framework . . . . . . . . . . . . . . . . . . . . . 15 2.4 Third-partyvendors .............................. 15 2.5 XPath ...................................... 16 2.6 Selenium..................................... 17 2.7 Cookies ..................................... 18 2.8 News....................................... 18 3 Methodology and project development 20 3.1 Methodology .................................. 20 3.2 Requirements .................................. 20 3.2.1 Software................................. 20 3.2.2 Hardware ................................ 21 3.3 Architectureoverview.............................. 22 3.4 Databasedesign................................. 23 3.4.1 Generalscope.............................. 24 3.4.2 Webscraperscope ........................... 25 3.5 API ....................................... 27 3.6 Webscraper................................... 29 3.6.1 ShadowDOM.............................. 32 3.7 Resultsportal.................................. 32 4 Results 41 4.1 Sitesanalyzed.................................. 41 4.2 Third-partyvendors .............................. 42 4.3 Consent Management Platforms . . . . . . . . . . . . . . . . . . . . . . . . 44 4.4 Purposes and data categories . . . . . . . . . . . . . . . . . . . . . . . . . 46 5 Budget 48 5.1 Developmentcost................................ 48 2
5.2 Deployment and long-term cost . . . . . . . . . . . . . . . . . . . . . . . . 48 6 Conclusions and future development 50 References 51 3
List of Figures 1 Project’s Gantt diagram. Source: Own. . . . . . . . . . . . . . . . . . . . . 11 2 Example of CMP use in the UPC’s website (https://upc.edu). Source: Own. 14 3 Purposes of TCF v1.0 and v2.0. Source: [8]. . . . . . . . . . . . . . . . . . 15 4 Diagram of the main architecture of Selenium. Source: [10]. . . . . . . . . . 17 5 AllAboutCookies.org survey result to user behavior question when faced with a cookie consent banner. Source: [11]. . . . . . . . . . . . . . . . . . . 19 6 Remote access to a Selenium Firefox instance running in Docker through noVNC.Source:Own. ............................. 22 7 Diagram of the overall architecture of the project. Source: Own. . . . . . . 23 8 Diagram of the general scope of the database. Source: Own. . . . . . . . . 25 9 Diagram of the scraper’s scope of the database. Source: Own. . . . . . . . 26 10 API documentation endpoint that uses Swagger. Source: Own. . . . . . . . 27 11 API administration interface: edition of Consent Management Platform record.Source:Own. .............................. 28 12 API administration interface: edition of an XPath selector record. Source: Own........................................ 28 13 Flow diagram of the web scraper’s action execution. Source: Own. . . . . . 29 14 API administration interface: edition of an Action record. Source: Own. . . 30 15 Screenshot of the web scraper analyzing a site. Source: Own. . . . . . . . . 31 16 Diagram of the structure of a DOM with a shadow DOM attached. Source: [32]........................................ 32 17 Quick statistics as shown in the results portal. Source: CMP Explorer [2]. . 33 18 Global third-party vendor density map of the results portal. Source: CMP Explorer[2].................................... 34 19 Third-party vendor distribution chart of the results portal. Source: CMP Explorer[2].................................... 35 20 Consent Management Platform quota chart of the results portal. Source: CMPExplorer[2]. ............................... 35 21 Purpose distribution chart of the results portal. Source: CMP Explorer [2]. 36 22 Data category distribution chart of the results portal. Source: CMP Explorer[2]. .................................... 37 23 Data summary for site ’lavanguardia.com’. Source: CMP Explorer [2]. . . . 38 24 List of third-party vendors for site ’lavanguardia.com’. Source: CMP Explorer[2]. .................................... 38 25 Third-party vendor density map of companies found in site ’lavanguardia.com’. Source:CMPExplorer[2]............................ 39 26 Third-party vendor connection tree of site ’lavanguardia.com’ with a limit of 10. Source: CMP Explorer [2]. . . . . . . . . . . . . . . . . . . . . . . . . 40 27 Consent Management Platform connection tree of site ’lavanguardia.com’ with a limit of 40. Source: CMP Explorer [2]. . . . . . . . . . . . . . . . . . 40 28 Density of third-party vendors whose location has been registered. Source: Own........................................ 44 29 Amount of sites that use each consent management platform. Source: Own. 45 4
List of Tables 1 Examples of XPath selectors used by this project. Source: Own. . . . . . . 16 2 Flag description of the scraper’s action table. Source: Own. . . . . . . . . . 25 3 Top 10 third-party vendors present in more sites. Source: Own. . . . . . . . 42 4 Top 10 sites with more third-party vendors present. Source: Own. . . . . . 43 5 Sites grouped by CMP used and their amount of third-party vendors (not full list and with skipped data). Source: Own. . . . . . . . . . . . . . . . . 43 6 Top 10 countries with more third-party vendors based at. Source: Own. . . 44 7 Top 10 CMPs with more third-party vendors related. Source: Own. . . . . 45 8 All purposes and the amount of times that they have been found by the web scraper. Source: Own. . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 9 All stacks found and the amount of times found by the web scraper. Source: Own........................................ 47 5
Acknowledgments I would like to thank the advisors of this project, Pere Barlet and Ismael Castell. Their invaluable guidance and experience have helped shape the direction of this project. I am thankful for the time and effort they invested in this project and I am deeply appreciative of the knowledge and experience they so generously shared. Finally, I would like to thank my family for their endless encouragement and support throughout this journey. 6
Abstract An increasing amount of third-party companies whose interests can be found nowadays embedded in almost every single website on the Internet collecting user data as users browse the Internet. Contrary to popular belief, this information is not collected by the big players in the market but by companies in the background that are widespread across the world. After the application of the General Data Protection Regulation which mandates consent must be obtained prior processing any data of an EU user and that processing purposes must be made available to the user prior consent collection, it is more clear what data is collected, why and by whom, but still could be more clear. The purpose of this master’s thesis is to study the collection of user data by third-party companies / vendors through consent management platforms. An automated system for collecting this information has been implemented, as well as a public portal for accessing all the results obtained. For an analysis of less than 1k websites, the presence of some companies in 65% of all analyzed sites has been demonstrated, showing how much information a company can know about a user just by its presence on multiple sites. 7
1 Introduction The Internet has evolved into a realm of instant gratification, where the expectation is to search, find, and know everything in the blink of an eye. Whether it is searching for the latest news, finding a restaurant nearby, or simply getting an answer to a question, the Web has conditioned us to be driven by immediacy and to expect results in seconds. This necessity of speed sometimes makes users overlook some important aspects when browsing the Internet, such as privacy. Throughout our searches, we leave small traces behind that enable companies to track our visits across different sites, and, in the end, enabling them to profile users as they navigate the World Wide Web. This tracking has become more obvious nowadays thanks to the GDPR [1], with websites being required to obtain explicit, specific, and fine-grained consent from users before processing their data. But still a substantial amount of users either directly grant full consent when going through the Internet or do not really pay attention to the consent configuration options present in the websites. In most cases, the sense of immediacy that drives us to expect and find what we are looking for in an instant is the reason behind the blind consent acceptance of some users. While GDPR has made it more clear for users to know what information about them is going to be stored and processed, and, in a certain way, has given them control over their data, it is still not clear where a user’s data going to end at. Companies, on the order of thousands, can be found at almost any given internet site, usually, along with the purposes and types of user data they are collecting. Despite this, there still remain quite a few unanswered questions regarding user data such as where your data actually end up or how much knowledge a company might have about an arbitrary user’s website history, just by leveraging their presence as third-party vendors across multiple sites. The main goal of this project is to perform an analysis of the companies that track users through their presence on multiple sites. An analysis of this kind will provide users with actual insights of the uses of their data and will enhance user privacy as it will enable them to better decide whether or not to grant their consent to given companies just by having some site metrics, such as company internet-wide presence or country of the company beforehand. In order to achieve this, an automatic tool will be implemented within the context of this project, capable of independently visiting a set of given sites and collecting, processing, and storing as much information as possible related to the third-party companies that can be found within a site: what companies are there, what data do they collect, and for what purposes. Finally, the results obtained from the automated analysis will then be displayed and available to freely to all Internet users through a public results portal. This tool, also developed within the scope of this project, will enable users to check in real time different metrics and graphics related to the study of the presence of third-party vendors within a previous analyzed site. 8
This project is comprised of the following parts, first, an introduction enumerating the goals the project means to accomplish, including the definition of objectives, work plan, and found deviations. Section two covers the technologies this project has leveraged to achieve its goals. Section three contains the project development and methodology. Sections four, five, and six cover the results obtained and the budget, respectively. Finally, section seven contains the project conclusions and possible future developments. 1.1 Statement of purpose This section enumerates the goals to achieve with this work. The project objectives are the following: •Extract the name of the third-party companies that are found the consent manager of many websites and types of data they process from each website visitor and they purposes they leverage for justifying its processing. •Identify the Consent Management Platform1used by each site when possible. •Localize the country of origin of each unique third-party company registered during site analysis. •Implement an online platform that allows users to visualize the results obtained. 1.2 Requirements and specifications The final development, result of this work, should accomplish the following requirements: •Navigate through arbitrary websites (web scraper): It should be able to try and navigate through any arbitrary website without expecting any specific website structure with the sole purpose of extracting the necessary information (listed in the following two items). •Detect third-party company names: From the presented website and through interaction via Selenium, it should be able to automatically detect company names listed as third-party vendors within a site without recurring any pattern matching technique. •Extract information: For each combination of site and third-party company, it should be capable of collecting, for each, the purposes each company uses for processing user data and the data categories collected by each company. •Detect Consent Management Platform: When the analyzed website uses a Consent Management Platform, it should be able to detect which one it is being use and register it in the database 1Consent Management Platform (CMP): An online platform that manages and facilitates user consent for data collection and processing, ensuring compliance with privacy regulations such as GDPR and CCPA. 9
When integrated within the context of a CMP, the third-party vendors communicate to the CMP the purposes and types of data they process for it to be shown in the user consent interface. Upon consent collection, it is the CMP’s responsibility to communicate the user’s consent to the third-party vendors. Usually each CMP maintains its own list of third-party vendors that the company who owns the CMP has agreements with, and that can be found in almost every website a given CMP is present in. Even if a particular website has a direct relationship with 10 or 20 third-party vendors, through the use of a CMP this number can come up to 1000 vendors. 2.5 XPath XML Path Language is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999 [9]. XPath can be used to locate specific parts of an XML document by using paths that describe the structure of an XML document. In the context of web development and web scraping, it is a critical component, as it is used to extract data directly from websites just by selecting elements from the HTML DOM5. In XPath expressions start with ”/” or ”//” in order to select an element from the root node or throughout the whole document, respectively. Following the start character, there are one or more element names (e.g. ”//div/button/span”). After the element names, XPath allows the possibility of filtering the results when given a set of conditions. It also includes some built-in functions for the manipulation of strings, numbers, and nodes, which enable complex queries on the document’s data. XPath expression Search result //div[@id=’lw-banner’] A div element whose id attribute is equal to ’lw-banner’ //iframe Any iframe //li/button/div/* Any element preceded by a li, button and div elements //h4[contains(@class, ’consentableItemTitle’)] An h4 element whose class attribute contains the text ’consentableItemTitle’ //div[@class=’cmpTitle’] A div with a class named ’cmpTitle’ Table 1: Examples of XPath selectors used by this project. Source: Own. 5Document Object Model (DOM): Cross-platform and language-independent interface that enables an HTML or XML document to be treated as a tree structure. 16
There are newer versions of the XPath standard, which allow for even more complex queries to be made just within the context of the selector expression. However, albeit existing new standards for XPath, for different reasons web browsers are still using XPath version 1.0. This project relies heavily on the use of XPath selectors to automatically select and scrape information from the websites analyzed. Due to the fact that only version 1.0 is supported, some of the complex searches done in the context of this project rely on post-search search steps to actually extract the desired information. 2.6 Selenium Selenium is an open source tool that is used to automate web actions in web browsers. It is more commonly used for testing web applications, but it can also be used for web scraping and for automating repetitive user interface tasks. Selenium is comprised of three core components: •Selenium client library: Allows Selenium to be used and directed through an API available for multiple languages such as Python, Java and so on. •Browser drivers: Communicates with the Web browser through a browser-specific interface and executes commands to perform the different actions in the web browser. •Browsers: The browsers in which the actions are executed. Selenium offers support for the most commonly used browsers like Chrome, Firefox, and Safari. Figure 4: Diagram of the main architecture of Selenium. Source: [10]. Selenium is the main tool used by this project to analyze websites. In addition to providing a fresh and independent Web browser environment for each analysis, it also allows for 17
parallel execution of multiple analysis at the same time. It is used in conjunction with XPath selectors to automatically find and select content from a website. 2.7 Cookies In the digital world, a cookie is a piece of data stored on a user’s device. They are usually set by the web server when browsing a website. Their purpose range from functional, used to keep track of a user’s session or its preferences, to marketing and tracking purposes. Cookies are saved to a specific domain, and as a user browses the Internet, they are sent along to the web server the pages are requested. The data cookies store, can be read and modified by any client either through tools of the web browser itself or with a few lines of code. Companies that run ads often use cookies to track the activity of their users. These companies employ several methods for tracking purposes, the most simple being simply setting a unique identifier in a cookie. As the user browses one of the company’s sites or others it is partnered with, the cookie is sent along to the web servers, which read the cookie’s value, thus identifying the user and keeping track of its browsing history through these sites. Although this project does not work with cookies directly, it focuses directly on the consent collection step, which, if on a legitimate site, would be the step prior to setting any cookie whose purpose is other than strictly necessary. 2.8 News In this section, we review news related to the knowledge of internet users about their behavior when faced with consent managers and the choice of accepting or rejecting cookies. A 2023 study conducted by AllAboutCookies.org [11] on a thousand US adults to ask them about cookies and about their interaction with cookie disclaimers. While about half of the people surveyed correctly identified the use of cookies for collecting analytic data on site usage and personalized ads, nearly 40% of the users responded that they blindly click ’Accept’ when asked about cookies. 18
Figure 5: AllAboutCookies.org survey result to user behavior question when faced with a cookie consent banner. Source: [11]. Another study [12] conducted by Avast in 2022, showed similar results. About 60% of the Spanish adults surveyed accept cookies blindly on a regular basis. The survey also showed that 67% of the users who always rejected cookies were concerned about the privacy implications of accepting them. Unfortunately, the study did not disclose the amount of responses collected by the survey. With both surveys showing similar results in terms of percentage of blindly cookies acceptance, it can be inferred that despite consent managers disclosing more information regarding the collected user data, users are mostly driven by immediacy and the unawareness, and most of the time choose to accept all cookies without considering the implications. A tool like the one built by this project could help raise user awareness in terms of their implication of giving full and blind consent. Letting users know how their data roam freely through the internet by the hand of data brokers and where they end up, might help lower the rate of users that ’Accept all’. 19
3 Methodology and project development This section covers the requirements of the project in terms of both software and hardware, as well as the working methodology applied to carry out the project. 3.1 Methodology No specific working methodology has been applied to this project. From the first goal and milestone brainstorming, the tasks were completed according to the original plan, while allowing some extra time for some unplanned bug fixing tasks, which were completed outside of their original designated time slots. Every week, during the duration of the project, we had a status report meeting. In the meeting the work done was discussed, as well as the issues encountered during the time in between meetings. At the end of the meeting, we defined work to be done for the next meeting. 3.2 Requirements 3.2.1 Software The following software has been used for developing the project: •Python [13]: High-level programming language that has been used for developing the API as well as the web scraper. The versions used for the API and the web scraper have been v3.10 and v3.11, respectively. •MySQL [14]: Relational database used to store all the data obtained by the web scraper. •Django [15]: Python-based web framework. It has been used to model and create the database through Django’s ORM6It has also been used to create the web application that displays the obtained results. •DBeaver [16]: An open-source SQL client and database administration tool. It has been used for performing manual queries against the database in addition to create some database views that Django’s ORM was unable to automatically. •Docker [17]: Open-source platform used for the deployment of application within portable containers. It has been used as a means to achieve portable Python environments across platforms. It has also been used for shipping and deploying the web application that displays the project’s results. •Firefox [18]/ Selenium [19]: Firefox has been used as an open-source web browser by Web Scraper. The Web Scraper would open Firefox and visit each registered 6Object-Relational Mapping (ORM): Programming technique that allows interaction with a database using the object-oriented paradigm. Database tables are treated as classes, and any change made to them is applied through automatically generated SQL queries. 20
website in the database. Selenium, as mentioned in the ’State of the art’ section, has been used for controlling Firefox through Python code. •noVNC [20]: Open-source HTML5-based application that provides remote desktop access through the browser. It has been used to provide a remote visual interface into Docker containers running the Selenium web drivers. This was done as a means of providing some debug and control aids to review the human-like interaction of the Web Scraper with the analyzed websites. •Overleaf [21]: A LaTeX editor. It can be used free of charge and is available online without the need of installing anything. It has been used to write this thesis. •GitHub [22]: Online version control system that uses Git. It has been used throughout the project to keep track of all the changes done to the project. •PyCharm [23]: An IDE (Integrated Development Environment) designed for Python. It provides integration with the Django framework, the version control system, and the Docker platform. It has been used to develop all Python code. •Leaflet [24]: Open-source JavaScript library used to create interactive maps. This tool has been used to display some metrics from the data obtained on a map. •Apache ECharts [25]/ Chart.js [26]: Both are open source JavaScript libraries used for the creation of charts and graphs. The two of them have been used to display the results obtained. 3.2.2 Hardware There are no specific hardware requirements for running this project and neither is the machine setup listed below. The full specifications of the machines used during the development and data acquisition are listed below: •Machine 1 (Running database, API and web scraper) –OS: Windows 10 Pro (64 bits) –Processor: AMD Ryzen 5 2600X @ 3.6 GHz –RAM: 32 GB (4x8GB) Corsair DDR4 3000MHz •Machine 2 (Running the Selenium web drivers with Firefox) –OS: macOS Sonoma (64 bits) –Processor: Apple M2 –RAM: 16 GB •Machine 3 (Used as an internet proxy by the web scraper) –OS: Ubuntu 22.04.4 LTS (64 bits) –Processor: Intel(R) Xeon(R) L5640 @ 2.27 GHz –RAM: 21 GB 21
3.3 Architecture overview This section will cover the architecture the project leverages to achieve its goals. First of all, and as explained in the hardware requirements, machine 1 will host the MySQL database as well as the API. While the data can be retrieved directly from the database, having a REST API in between ensures some control and validation is done over the data that both client and administrator create and update. The logic portion of the web scraper also is executed in this machine, that is, the part of the scraper that commands the web drivers that can be hosted in the same machine or somewhere else. The Selenium web drivers are hosted on machine 2, mainly due to the increased performance compared to the other two machines. To ensure that the web drivers run always the same and that any machine changes or changes to the libraries in the computer that is hosting them, the web drivers are containerized. For macOS they run a Docker image called ’seleniarm/standalone-firefox’ [27] and for Windows they run an image called ’selenium/standalone-firefox’ [28]. The reason for using different images is that Selenium’s official Docker images were not compatible with arm architecture at the time of developing this project. Typically, Selenium runs headless, meaning that there is no interface of what is happening in the browser. The Selenium-Firefox Docker images above mentioned in addition to running the web browser also run a VNC / noVNC server for allowing remote access to the drivers. This allows for progress of the web drivers to be monitored at any given time through the browser. It is also useful in situations where browsers get stuck. Figure 6: Remote access to a Selenium Firefox instance running in Docker through noVNC. Source: Own. All Firefox instances are configured to run using machine 3 as a web proxy. The web proxy running in machine 3 is just an open SSH session with a dynamic proxy set for as many ports as Firefox instances. The dynamic port forwarding of SSH leverages the SOCKS 22
protocol [29], with this setup all relevant traffic of the Firefox instances is routed through the SSH connection. Figure 7: Diagram of the overall architecture of the project. Source: Own. In the original project architecture, there was no intention of using any kind of proxy. However, during the first tests of the whole project setup, my public IP was being banned within visiting a few sites, mainly due to high amount of sites the scraper was going through in a short period of time and the rightful and strong anti-robots techniques employed by some sites. This meant having to restart the router every few minutes and wait for the current IP address to be released and have a new one assigned. To overcome this, the advisors of this project provided a server with an IP from the UPC. Usually, IPs from universities are whitelisted due to the large number of users behind them. Using this server and IP ended up with the project being flagged as a malicious robot. 3.4 Database design The database can be divided into two scopes: a general scope and a web scraper scope. The general scope contains all the tables used for storing the data found during the website 23
analysis in addition to auxiliary static data used for searching with pattern matching within a site (e.g. list of purposes, list of CMPs, etc). On the other hand, the web scraper’s scope contains all the static data that build the analysis to be performed (e.g. list of actions to be done during the analysis, library of XPath selectors, etc.). 3.4.1 General scope In order to initialize the database with the necessary tables, it is necessary to define what must be saved to the database. Starting with the basics, there are the data about the purposes and data categories. These two are key elements of information that we aim to find when analyzing any site, so they must reside in the database. To populate them with data, IAB Europe provides a list with links to JSON documents in which both the data categories and the purpose list [30] are served in many different languages. Due to the geographic position of our IP, English and Spanish JSONs were loaded into the database. Continuing with basic data, there is also a table for the websites analyzed and for the consent management platforms. For each CMP it is stored its name, its ID in IAB Europe’s directory, and an XPath selector for identifying. This table is manually loaded with a list [4] of CMPs also provided by IAB Europe. Since not all CMPs in the list are supported, a boolean flag named ’scraping’ is also added to the table of CMPs. When this flag is false, the scraper will only identify the CMP it is using and start analyzing another site. The criteria followed to determine whether or not a specific CMP can be scrapped is just a manual check-up. If a given consent manager does not display some information or has a really complex user interface, it is deemed not scrapable. Last but not least, a table is also created for storing the name of the third-party companies found in the analysis. Each site may have only one CMP assigned to it and can have multiple third-party companies linked to it. Each third-party company can have multiple purposes and data categories assigned to it. 24
Figure 8: Diagram of the general scope of the database. Source: Own. 3.4.2 Web scraper scope The idea behind the web scraper is to be as generic as possible and to have it change the analysis it performs, in terms of actions, just by changing a table in the database, not a single line of code. To achieve this, there is a table for storing actions, which has Boolean flags for each action the scraper is programmed to do. That is, a true on the click element’ will make the scraper click the first matching element it finds. The full purpose of each flag is as follows: Flag Purpose find element Find first element matching a given selector. find inside collapsible Click and search inside every collapsible element of the page. find inside iframe Search inside iframe elements. click element Click the first element matching a given selector. click all elements Click all elements matching a given selector. fill element Fill-in the element (intended for input elements) with whatever value the field ’field element user data key’ indicates. stopper If action is unsuccessful, skip to the next site in the list. register in db Run the Python function specified in the ’register function name’ with all the elements matching a given selector. Table 2: Flag description of the scraper’s action table. Source: Own. 25
was used. After finding the company name, the scraper goes on to look for all purposes and data categories that are registered in the database. If any is found, they are saved to the database through the API. A demonstration of the Web Scraper running an analysis on a website can be found referenced here [?]. 3.6.1 Shadow DOM The shadow DOM is part of the web components standard that enables developers to build encapsulated elements. It works by creating a ’shadow’ tree of DOM elements that is isolated from the main document’s DOM. This isolation prevents style and script conflicts with the elements in the shadow DOM and those in the main one. One example of its usage are the video elements. They are created by placing a video tag in the HTML document with an attribute indicating the source of the video. The video controls (e.g. play, stop, etc.) exist in a shadow DOM that hangs off the video element. Figure 16: Diagram of the structure of a DOM with a shadow DOM attached. Source: [32] In the context of the web scraper, the usage of shadow DOMs renders completely unusable the default search functions provided by Selenium. Since the default search functions only search in the main DOM, elements that are located in shadow DOMs are invisible to them. To overcome this, I found a Python library called pyshadow [33] that is capable of searching within shadow DOMs. This library replaced the calls to the default Selenium search functions and solved the problem. 3.7 Results portal The remaining requirement of the project is to provide a way of displaying the results obtained. As introduced previously, the idea behind the web application portal is to make publicly available the obtained results for anyone to view. 32
The web application is built also in Django, since it allows us to build also server-side rendered frontends, and the existing API is also built in Django. The results obtained are displayed in two scopes. In a global scope, the results are aggregated and shown to the user providing overall statistics of all the collected data. And, in a more detailed scope, the user is able to search or select a domain from the ones analyzed to view specific metrics on that site. The first results on the global scope show a summary of the numbers obtained throughout all sites analyzed. This summary includes the total amount of analyzed sites and the total number of unique identified third-party vendors among others. This first section also contains two rankings listing the top 10 companies with presence in more sites and the top 10 sites with more third-party vendors. Figure 17: Quick statistics as shown in the results portal. Source: CMP Explorer [2]. Following the above-mentioned summary, an interactive world map displays the thirdparty vendor density per country. Around 1500 companies out of the 4500 approximately total companies registered in the database have been manually searched and assigned a country in the database corresponding to the country they are based at. In the map, a darker country color depicts a higher density of identified third-party vendors. This process is completely manual, requiring quite a few searches on Google and Open Corporates [35] to find the location of some companies. Some attempts were made to provide an automated method of locating these companies using both Web scraping in Google and some specific APIs through their free plan. Unfortunately, Google makes web 33
scraping their organic results almost impossible and using paid APIs did not align with the open-source philosophy I align with. For this reason, some companies may remain country unidentified at the time of writing this thesis. Figure 18: Global third-party vendor density map of the results portal. Source: CMP Explorer [2]. Finally, constituting the end of the global statistics several graphics are displayed showing the following information: •Top 100 third-party vendor distribution: Bar chart displaying out of the 100 companies with presence in more sites, the amount of sites they have presence in. •Consent Management Platform distribution: Pie chart represent the site quota per consent manager platform. That is, how many sites use each CMP. •Purpose distribution: Polar area chart showing how many times each TCF [8] purpose has been used globally. It counts unique occurrences of purpose, site, and company sets. •Data category distribution: Polar area chart showing how many times each TCF [8] data category has been used globally. It counts unique occurrences of data category, site, and company sets. 34
Figure 19: Third-party vendor distribution chart of the results portal. Source: CMP Explorer [2]. Figure 20: Consent Management Platform quota chart of the results portal. Source: CMP Explorer [2]. 35
Figure 21: Purpose distribution chart of the results portal. Source: CMP Explorer [2]. 36
Figure 22: Data category distribution chart of the results portal. Source: CMP Explorer [2]. For the detailed scope, the user must select a domain from the ones registered in the database. The user has two ways of achieving this: through the auto-complete search box and through the selector just below the search box. The selector aims to provide a quick way of finding a site that has been analyzed and therefore will display the data. This was done like this since the database has way more sites that the web scraper has analyzed at the moment. In the detailed or site scope, similarly to the global scope, there are some overall data on the site’s collected data. This data includes the total number of purposes and data categories utilized by the site in addition to which of them, as well as the total amount of third-party vendors and the CMP used by the site. There is also an automatic message explaining the implications of having a company with an extremely high presence on the Internet. The message aims to make the user reflect on how much a company can know about an individual just by its presence on the sites that the individual visits. 37
Figure 23: Data summary for site ’lavanguardia.com’. Source: CMP Explorer [2]. Following the site-specific summary, the list of third-party vendors of that site is displayed. Each company listed is categorized in terms of their presence. In the list, any vendor with presence in less than 10 sites is considered to have a low presence. Other vendors present in more than 10 but less than 40 sites are considered to have a medium presence. Any other vendor with a presence at more than 40 sites is considered to have a high presence. Figure 24: List of third-party vendors for site ’lavanguardia.com’. Source: CMP Explorer [2]. In the specific scope, there is also a world map of third-party vendor density. In this case, the map only displays data related to the third-party vendors found on this site. This specific map aims to provide the user with an overall view of where their data are going. 38
Figure 25: Third-party vendor density map of companies found in site ’lavanguardia.com’. Source: CMP Explorer [2]. Finally, two tree graphs display the connection of the selected site with others. The first tree shows the connection to other sites through the presence of third-party vendors. That is a vendor that can be found in the searched site, as well as others. The second one also represents the connection to other sites but just by the CMP used by the site. Both trees are initially limited to displaying no more than 10 records in each. This is due to the high amount of vendors that can be found in most sites. In not too powerful machines, displaying all of the data would cause the browser to crash, hence the reason for the variable limit. The two trees are also meant to consolidate what the above-mentioned message box explains. Their purpose is to shed some light on the user and let him visually see two methods with which he might be tracked. 39
Figure 26: Third-party vendor connection tree of site ’lavanguardia.com’ with a limit of 10. Source: CMP Explorer [2]. Figure 27: Consent Management Platform connection tree of site ’lavanguardia.com’ with a limit of 40. Source: CMP Explorer [2]. 40
4 Results In this section, the results of the collected data are presented. The data were obtained automatically using the result of the web scraper component of this project and stored in the database. The data acquired were collected during the period comprising between May and August 2024. The list of sites with which the database is populated was populated with the Tranco list [37]. The sites on this list are an aggregate of multiple rankings and are updated daily. The sites were loaded twice into the database. The first time with a partial set of the full Tranco list and a second time with a configured set of domains seen only in European countries. 4.1 Sites analyzed From around 1 million sites loaded into the database, about 6000 sites were fully analyzed and analyzed. Of these 6000 sites, the web scraper was able to collect partial data (CMP identification) from 682 sites. Full data (vendor, purposes, data categories, and CMP identification) was collected for 338 sites. At first glance, these numbers give the web scraper an analysis success rate of 11.36% for partial data collection and 5.63% for full data collection, which is not quite good. However, a set of factors that affected from the beginning of this project are the reason behind these low rates, with the first being the list of sites. While the Tranco list provides a list of sites useful for benchmarking, reasearch, and security, it does not fully meet the requirements of this project. Ideally, for this project, the list of sites would be composed of at least a 95% of sites that are running, up to date, and that follow GDPR guidelines by having either a consent banner or employing a consent management platform. This is not the case with the Tranco list, as most of the sites do not meet these requirements. During the monitored data acquisition, a great percentage of the sites analyzed did not have any CMP nor consent information due to various reasons (e.g. site based outside of Europe, site of dubious legality, domains that no longer exist, listed domains that are used for technical purposes but that have no actual website available, etc.). Had the set of sites analyzed been domains following European guidelines and that are fully functional and reachable by internet users, the number of unanalyzed sites by the web scraper would be minimum. Another factor that greatly influenced these results is the data acquisition period. This period began while still in the development phase of the project, which means that not all of the components might not have been fully capable at the beginning when compared with the final capabilities. The web scraper was not running also full-time in the data acquisition period, and an arbitrary site analysis takes about 10 minutes on average. At the moment, it also requires 41
5 Budget In this section, the costs of developing the whole project as well as the costs of running the project full-time on the long term. Being a relatively small project that has been accomplished with a single developer, the necessity of a project manager is deemed unnecessary, and therefore not included within the development costs. 5.1 Development cost Initially, 394 hours were planned for the project. However, 40 h from this assignment were allocated for preparing the lecture. These hours do not fit the definition of a development with commercial purposes, in which no lecture is usually given, and therefore are not included in the budget. The hours allocated for the writing of the thesis are kept as it can be used as documentation. The final planned time is 354 hours. These hours exclusively include the development of the project in terms of the original requirements. It does not account for last-minute changes that could caused by changes in the requirements or the infrastructure of the client. To cover for any unexpected issue that might be encountered during the handover to the customer and to provide some flexibility to the requirements and include last-minute changes, an additional 50 hours are added to the hours bank. These additional hours are also included in the budget. The cost per hour of a software engineer (not a junior, with between 3 to 4 years of experience and that is paid fairly) which could achieve the development of the project without any difficulties has been set at 30€per hour, without including taxes. With a total of 404 hours allocated, the cost of developing this project amounts to 12.120€, 14.665,2€including 21% taxes. No tax reduction has been considered in the concept of R+D. 5.2 Deployment and long-term cost In the case of a deployment starting from nothing and with the project being hosted offpremises, the costs of the initial deployment would include the provision and configuration of a new machine in addition to the running configuration of the project. A server running full-time with similar specifications to those described in the hardware requirements section (16 core CPU with 16 GB of RAM) amounts, in 2024, to 38.41€ per month including taxes. This machine would easily run the database, web scraper, and results portal at the same time without any issues. Configuring a newly provided machine takes on average around 3 hours. This time includes securing access to the machine, updating and installing necessary software, setting up a 48
firewall and a basic intrusion detection system, as well as validating that all services are running as expected. Considering no major issues are found during the rollout of the project, an additional 3 hours would be spent configuring all components including the database schema creation and permissions configuration. Also included in the budget is a dedicated ’.es’ domain to make the results portal easily accessible, costing approximately €6.99 per year. Initially, 6 hours of manual labor will be billed for project installation, totaling €180. With taxes 21%, the cost is €217.80. The annual running costs for the server and domain are estimated at €467.91, assuming no discounts are applied and no long-term agreement is made with the server provider. 49
6 Conclusions and future development This final section presents the conclusions of this project. This section also covers the future lines of development that this work can follow. The main goal of this project was to do some research on the information provided by consent management platforms about the third-party companies that are found in most sites and the data they collect from the users who visit them. With this in mind, an automated system capable of independently analyzing any given site and trying and collecting information related to the user consent has been implemented. It has also been set to analyze a set of sites from which a general idea on the companies and data uses has been recovered. From the obtained results, we have seen that the number of third-party companies found within a site is usually defined by the consent manager platform a particular site employs, and not by the site itself. More than 4,000 unique third-party companies have been identified that have been found after just fully analyzing less than a thousand sites. This sheds some light onto how big the data broker market is, and we have been able to put a number into how much interest there is on user data. Although the number of sites analyzed could have been larger had a better list of sites been used, the information that has been collected is still valuable and useful to provide a lot of service in different areas. We have also demonstrated the high presence some third-party companies have, and just how much information they can actually know just by their presence on a lot of sites. Also within the automated analysis, a small study of the consent management platform market has been made, making possible a general overview on who the big players in this area are and just how bug their presence actually is. We have also been able to identify the country of origin of a small part of all uniquely identified companies. This has made possible to provide some insights on how user data are actually spread globally, even when a user visits a local site to him / her. Finally, a public portal has been implemented and made available to anyone on the Internet. This enables anyone who wants to view the obtained data by themselves and realize how serious user privacy should be taken. The project leaves several areas from which it can be extended. Starting with the inclusion of artificial intelligence and computer vision technologies. Leveraging these technologies could enable the project to do more in-depth analysis in way more sites than is possible now and in a more efficient manner. For instance, using computer vision could make the web scraper work for any site as it avoids programmatic search, and AI could be used to collect even more data from the sites such as the privacy policy. 50
References [1] European Parlament and Council. Regulation (eu) 2016/679 of the european parliament and of the council of 27 april 2016 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data, and repealing directive 95/46/ec (general data protection regulation). Available at https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX [2] Rodrigo Cabezas Quir´os. Cmp explorer. track the trackers: Explore how your data is shared among third parties. Available at https://cmp-explorer.rcq.es/. [3] Ismael Castell Pere Barlet. Online resource mapper (orm). Available at https://github.com/CBA-UPC/ORM/tree/master. [4] IAB Europe. Cmp list. Available at https://iabeurope.eu/cmp-list/. [5] IAB Europe. Main page of iab europe. https://iabeurope.eu/. [6] Proton Technologies AG. What is gdpr? Avaialable at https://gdpr.eu/what-is- gdpr/. [7] IAB Europe. Transparency and consent string with global vendor & cmp list formats. Available at https://github.com/InteractiveAdvertisingBureau/GDPR- Transparency-and-Consent-Framework/blob/master/TCFv2/IAB [8] Prashant. Transparency and consent framework (tcf) – from 1.0 to 2.0. Available at https://headerbidding.co/iab-tcf/. [9] World Wide Web Consortium. Xml path language (xpath) version 1.0. https://www.w3.org/TR/1999/REC-xpath-19991116/. [10] Sonal Dwivedi. Architecture of selenium webdriver. Available at https://www.browserstack.com/guide/architecture-of-selenium-webdriver. [11] Josh Koebert. Cookies study: 40 Avaiable at https://allaboutcookies.org/internetcookies-survey. [12] LF Channel for Avast. Acceptallcookies?: El 60 Avaiable at https://press.avast.com/es-es/acceptallcookies-el-60-de-los-espanoles-aceptan- las-cookies-digitales-a-pesar-de-desconocer-como-funcionan-realmente. [13] Python Software Foundation. Python. Avaialable at https://www.python.org/. [14] Oracle. Mysql. Avaialable at https://www.mysql.com/. [15] Django Software Foundation. Django. Avaialable at https://www.djangoproject.com/. [16] DBeaver. Dbeaver - universal database tool. Avaialable at https://www.djangoproject.com/. [17] Docker Inc. Docker: Accelerated container application development. Avaialable at https://www.docker.com/. 51
[18] Mozilla. Firefox browser. Avaialable at https://www.mozilla.org/es-ES/firefox/new/. [19] Software Freedom Conservancy. Selenium. Avaialable at https://www.selenium.dev/. [20] noVNC. novnc. Avaialble at https://novnc.com/info.html. [21] Overleaf. Overleaft, online latex editor. Available at https://overleaf.com/. [22] Inc. GitHub. Github. Available at https://github.com/. [23] JetBrains. Pycharm. Available at https://www.jetbrains.com/es-es/pycharm/. [24] Volodymyr Agafonkin. Leaflet. Available at https://leafletjs.com/. [25] The Apache Software Foundation. Apache echarts. Available at https://echarts.apache.org/en/index.html. [26] Chart.js. Chart.js. Available at https://www.chartjs.org/. [27] Docker / Seleniarm. Selenium firefox container image for arm platforms. Avaiable at https://hub.docker.com/r/seleniarm/standalone-firefox. [28] Docker / Selenium. Selenium firefox container image. Avaiable at https://hub.docker.com/r/selenium/standalone-firefox. [29] Wikipedia. Socks. Available at https://en.wikipedia.org/wiki/SOCKS. [30] IAB Europe. List of translations for purpose descriptions tcf eu v2.2. Available at https://register.consensu.org/Translation. [31] Django REST framework. Django rest framework. Available at https://www.djangorest-framework.org/. [32] Mozilla. Using shadow dom. Avaialable at https://developer.mozilla.org/en- US/docs/Web/API/Web components/Using shadow DOM. [33] Sushil Kumar Gupta. pyshadow. https://github.com/sukgu/pyshadow. [34] Rodrigo Cabezas Quir´os. Tfm rodrigo cabezas quir´os — tracking the trackers - web scrapper demo. Available at https://www.youtube.com/watch?v= T vZ3KQ3lk. [35] Open Corporates Limited. Open corporates. Available at https://opencorporates.com/. [36] Volodymyr Agafonkin. Using geojson with leaflet. Available at https://leafletjs.com/examples/geojson/. [37] Victor Le Pochat, Tom Van Goethem, Samaneh Tajalizadehkhoob, Maciej Korczy´nski, and Wouter Joosen. Tranco: A research-oriented top sites ranking hardened against manipulation. Available at https://tranco-list.eu/. [38] IAB Europe. Iab europe transparency & consent framework policies. Available at https://iabeurope.eu/iab-europe-transparency-consent-framework- policies/#˜:text=require%20this%20feature.-,E.%20Stacks,-Stacks%20may%20be. 52