<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Merlijn van Lent on Medium]]></title>
        <description><![CDATA[Stories by Merlijn van Lent on Medium]]></description>
        <link>https://medium.com/@merlijnvanlent?source=rss-9d5ccb75b7ce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CxhqSnzlwu3bsHtd6DxGEg.jpeg</url>
            <title>Stories by Merlijn van Lent on Medium</title>
            <link>https://medium.com/@merlijnvanlent?source=rss-9d5ccb75b7ce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 00:52:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@merlijnvanlent/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Apple’s App Tracking Transparency Framework a TL;DR for web developers]]></title>
            <link>https://merlijnvanlent.medium.com/apples-app-tracking-transparency-framework-a-tl-dr-for-web-developers-260776d66fd9?source=rss-9d5ccb75b7ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/260776d66fd9</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[cookie-consent]]></category>
            <dc:creator><![CDATA[Merlijn van Lent]]></dc:creator>
            <pubDate>Mon, 04 Oct 2021 18:14:46 GMT</pubDate>
            <atom:updated>2021-10-04T18:14:46.282Z</atom:updated>
            <content:encoded><![CDATA[<p>Apple is definitely not a new kid on the block when it comes to privacy. Their rules about tracking users and collecting data are some of the strictest in the industry. But now with the new ATT (<a href="https://developer.apple.com/documentation/apptrackingtransparency">App Tracking Transparency</a>) Framework these rules might reach beyond the codebase of your IOS app and leak into your website and block the release of your app because of how your website tracks users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBmfvZ61fI_wqtH0wfH4zA.jpeg" /></figure><h3>The problem</h3><p>Apple treats everything that happens inside your app as your responsibility even if your app uses some kind of in-app browser the opened web page still has to respect the ATT rules. For the people reading this who do not know what the ATT Framework does exactly. The ATT Framework is Apple’s solution for requesting user authorization to track them in IOS apps. You might have seen this yourself if you are running IOS 14 or later. During the startup of a newly installed app, a pop-up might appear to ask your permission for tracking and collecting data about the usage of the app.</p><p>When using an in-app browser in your application such as the <a href="https://developer.apple.com/documentation/webkit/wkwebview">wkwebview</a> you have to pass the ATT status to the web page and depending on the status load all tracking scripts, add cookies to the cookie jar etc, etc. When the ATT is accepted you should not ask consent for tracking or to place cookies in the cookie jar and just do it because the user already accepted all of that via the ATT. Asking for permission then will only hinder the user experience and Apple will even block the release of your app.</p><h3>Brainstorming solutions</h3><p>There are of course many solutions to this problem as is with anything that has to do with programming. One of the first ideas we had, when we encountered this issue, was to simply append a query parameter to the URL with the current status of the ATT. So for example we would open a URL like this:</p><p><a href="https://www.example.com/?attStatus=accepted"><em>https://www.example.com/?attStatus=accepted</em></a></p><p>And of course when the user did not accept the ATT the value would be set to rejected. This solution works great. Depending on the existence and value of that query parameter you can determine if you should start tracking the user. However, this solution breaks when the user navigates to a different page by tapping a link. The query parameter gets lost and on the next page load and the normal cookie consent gets shown and tracking scripts get loaded. Adding the query parameter with the current status to all links on the current page could be a solution but gets messy very quickly.</p><h3>The solution</h3><p>The solution we settled on eventually and currently use in production is super simple and still an elegant solution. What we do is append the ATT status to the browser’s user agent. Notice how I wrote append instead of change to in this instance. This is because the user agent is used for way more than only passing the ATT status. Analytics tools such as Google Analytics use it to determine what device is used and classify if it is a desktop or mobile device. And the user agent can also be used for feature detection to determine if a device has a touchscreen for example and we wouldn’t want to mess with that accidentally.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca337ed2397420ca5c2ab6f486ffe720/href">https://medium.com/media/ca337ed2397420ca5c2ab6f486ffe720/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d596a5e2aa1e1f349223b747c4d5a77b/href">https://medium.com/media/d596a5e2aa1e1f349223b747c4d5a77b/href</a></iframe><p>And now on your website you can simply parse the user agent and look for either ‘ATTAccepted’ or ‘ATTRejected’. The only problem is that you have to be very careful about the text constants which are used to pass the status from Swift to Javascript. Those have to be in the same spelling and capitalization!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8aa1e5927882915e8950e4bdbfeb5de3/href">https://medium.com/media/8aa1e5927882915e8950e4bdbfeb5de3/href</a></iframe><h3>That wasn’t that bad</h3><p>Well. That was not that bad, right? The user agent is not really intended to pass data to a website but it is a nice and elegant solution to persistently store simple settings. This idea can really be used to pass any data to a browser such as the current dark mode preference.</p><p>I would like to give a massive shoutout to <a href="https://nl.linkedin.com/in/milanstevanovi%C4%87">Milan Stevanović</a> for providing the swift code snippets and guiding me through some of the caveats of the Apple ecosystem.</p><p>Would you like to increase your Digital Firepower? Check out <a href="https://van-ons.nl/en/">Van Ons</a> an awesome full-service internet agency based in the heart of Amsterdam. With a team of 25 WordPress experts who work day and night to make the internet a bit more beautiful and enjoyable every day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=260776d66fd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>