Is the user agent string considered personal data?
<p>I have a website. I would like to store the <code>user agent string</code>, <code>current time</code> and <code>opened url</code> (not the <code>IP</code> address or something else) in a database for each page visit to be able to build some statistical measurements.</p>
<p>The user agent string looks like:</p>
<pre><code>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36
</code></pre>
<p>Is this considered storing personal data? Do I need user's consent?</p>
<p>Thank you!</p>

<h1>Is X considered personal data?</h1>
<p>Can you use X to directly or indirectly identify a natural person? In the data to which you have access can X be related to an identifiable natural person?</p>
<p>If you answer yes to either of those questions then X is personal data.</p>
<p>Article 4(1):</p>
<blockquote>
<p>‘personal data’ means any information relating to an identified or
identifiable natural person (‘data subject’); an identifiable natural
person is one who can be identified, directly or indirectly, in
particular by reference to an identifier such as a name, an
identification number, location data, an online identifier or to one
or more factors specific to the physical, physiological, genetic,
mental, economic, cultural or social identity of that natural person;</p>
</blockquote>
<p>Scenario 1: you want to count each user agent that comes to your site, that's the only data you have, then the user agent is not personal data (it cannot be used to identify someone - unless it has a name and address etc, which seems highly unlikely - and you cannot relate it to anyone).</p>
<p>Scenario 2: you have customer records with names, addresses etc (clearly personal data) and want to record each customer's user agent then the user agent is personal data (it relates to the identifiable natural person).</p>
<p>Scenario 3: in one dataset you record that a user agent was associated with order ID 123456 and in another dataset you record that order ID 123456 was for John Smith (plus address etc), then the user agent is personal data (it relates to the identifiable natural person).</p>
<h1>Is this considered storing personal data?</h1>
<p>If X is personal data.</p>
<h1>Do I need user's consent to record X?</h1>
<p>If you want to record X and X is personal data, then you must have an Article 6 lawful basis for recording X. Consent is one of the six lawful bases.</p>
<blockquote>
<ol>
<li>Processing shall be lawful only if and to the extent that at least
one of the following applies:</li>
</ol>
<p>(a) the data subject has given consent to the processing of his or her
personal data for one or more specific purposes;</p>
<p>(b) processing is necessary for the performance of a contract to which
the data subject is party or in order to take steps at the request of
the data subject prior to entering into a contract;</p>
<p>(c) processing is necessary for compliance with a legal obligation to
which the controller is subject;</p>
<p>(d) processing is necessary in order to protect the vital interests of
the data subject or of another natural person;</p>
<p>(e) processing is necessary for the performance of a task carried out
in the public interest or in the exercise of official authority vested
in the controller;</p>
<p>(f) processing is necessary for the purposes of the legitimate
interests pursued by the controller or by a third party, except where
such interests are overridden by the interests or fundamental rights
and freedoms of the data subject which require protection of personal
data, in particular where the data subject is a child.</p>
<ol start="2">
<li>Point (f) of the first subparagraph shall not apply to processing
carried out by public authorities in the performance of their tasks.</li>
</ol>
</blockquote>

<p>A user agent string may be personal data depending on how it is processed. Aggregate statistics of user agent strings are not personal data. But if you combine user agent records with IP addresses or other identifiers, the user agent string would relate to a data subject that you can single out/identify.</p>
<p>While user agent strings can contain arbitrary text (someone could override their user agent to put their name, street address, and tax ID there), this does not seem to be particularly relevant. For GDPR compliance, it matters more how you process the data.</p>
<p>While GDPR is a foundational data privacy law in the EU, the ePrivacy directive goes into more detail for internet and telecommunication services. A user agent string would usually fall under it's definition of “traffic data” because it's generally transmitted as a HTTP header. Per ePrivacy Art 6, traffic data can only be processed:</p>
<ul>
<li>for transmitting a communication, e.g. to have your web server respond with different content depending on mobile or desktop user agents;</li>
<li>when the data is made anonymous, e.g. as part of aggregate statistics on browser versions;</li>
<li>for billing purposes;</li>
<li>or when the user consents, where “consent” is defined by the GDPR.</li>
</ul>
<p>However, the ePrivacy directive is not immediately applicable law, and every EU member state has its own law implementing this directive. Thus, you should look at the laws in the country in which you reside. These laws do not override GDPR but augment it, so you still have to ensure GDPR compliance (such as having a legal basis per GDPR Art 6 for every processing of such data).</p>
<p>I think that recording {url, date, user agent} tuples for the purpose of building statistics is <em>not</em> personal data in your context, or is at least a processing of personal data that doesn't require identification per GDPR Art 11. Such records would likely count as “anonymous” in the sense of ePrivacy, so that you can collect such statistics without having to ask for consent.</p>
<p>However, if a user agent is rare relative to the traffic volume on your site, it would still be possible to single out a particular user. Thus, it could make sense to break the connections between date and user agent or to never store individual records, just aggregate data. Speaking as a software developer, reasonable solutions might include:</p>
<ul>
<li>using streaming Bloom filters to avoid storing unique records, or using other privacy-preserving probabilistic data structures</li>
<li>only storing denormalized records, and truncating/rounding timestamps to avoid linking events via their time. Instead of one table with a {url, timestamp, user agent} per event you might have separate tables with {url, time slot, counter} and {user agent, time slot, counter} aggregate records were the time slots are appropriately spaced for the traffic of the site.</li>
</ul>

<blockquote>
<p>Is this considered storing personal data? Do I need user's consent?</p>
</blockquote>
<p>No. Article 4(1) of the <a href="https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:32016R0679" rel="nofollow noreferrer">GDPR</a> defines <em>personal data</em> as &quot;<em>any information relating [directly or indirectly] to an identified or identifiable natural person</em>&quot; (brackets added). The closest your sample gets to that is the IP address. Due to how IP addresses are managed, typically an IP address alone is not enough for identifying a natural person.</p>
<p>Recital 30 mentions <em>internet protocol addresses</em> as an example of data which might identify natural persons &quot;<em>when combined with unique identifiers and other information received by the servers</em>&quot;. The sample you show does not contain other information that used in combination with the IP address would result in, or facilitate, that identification.</p>

gdpr