With very recent new laws on data privacy coming into effect, user consent is gaining momentum. Since the far-reaching General Data Protection Regulation (GDPR) took force on May 25, 2018, companies that cater to or track EU citizens must demonstrate compliance with its data protection and accountability principles. In 2019, the French national data protection authority CNIL used the GDPR to take an immense bite out of Google’s revenues: Oh là là!
Even if you don’t dine with fine wine, or even if Europe may not be your cup of tea, there is a significant need for awareness also in North America and globally. The California Consumer Privacy Act (CCPA) went into effect Jan 1, 2020, with additional protections effective Jan 1, 2023. There are also the Canadian Consumer Privacy Protection Act (CPPA), the Australian Privacy Act reforms, and others on the horizon.
The trend is evident. It’s time to learn to ride the wave. If you are a dev, then you are already out on the water. Surf’s up, so let’s see how Split helps you catch the momentum, pop up and fly.
In this article, we will show you how to use Split SDK’s user consent capabilities, newly available in iOS, to stay on top of the game. You can clone our demo project on GitHub, coded with Swift 5 in Xcode 14.2, supporting iOS 15.0+, and watchOS 8.0+. This tutorial builds on the earlier code example in Setting Up Event Tracking in Your WatchOS App.
How to Make Use of Split’s User Consent Features
Let’s use Split’s new support for user consent to control what data is sent to Split Cloud easily. Specifically, the Split SDK allows you to start with an
denied state for user consent. The user consent can then be toggled between
denied. If user consent is granted, the Split SDK will send encrypted tracked events and feature flag evaluation information to a private data center. If user consent is denied, this data will not be cached nor sent out.
SplitWrapper class initializer, we will set the new
userConsent property of the
SplitClientConfig class to unknown:
We next pass the
UserConsent.unknown value to the Split factory.
unknown user consent value sets up the Split SDK to create feature flag evaluation and event data and initially cache this data only on the watch (on the physical device). Note that the information is not sent to Split Cloud, and if the app is terminated in this state, this locally cached data is permanently deleted.
We also define a private
@Published variable to make use of the Combine reactive programming framework to update the views when the user makes a choice.
Now, we can expose the ability to set user consent values in the Split SDK using the following two property definitions for
These changes in our
SplitWrapper.swift class equip us to set up a prompt to request consent to store the user’s workout choices, giving the user full control of the event data generated in the app.
In our accompanying code example, our prompt is defined in
SplitUserConsentView.swift, and looks like this:
Great progress so far! Now, at this point in your coding, you will need to familiarize yourself with the privacy laws that you are aiming to meet. This will determine how you will persist and display the user consent value. For example, the GDPR requires that the user can view and modify the app’s data collection and usage settings at any time. This means you will need to add these settings to an accompanying iOS app, and then listen for changes to these settings in your watchOS app. Though this is not covered here, you can learn how to do this by looking up the WatchKit Settings Bundle.
Split iOS SDK’s user consent capabilities give you perfect control over user data, including pseudonymous data, that may be stored in Swift cloud or passed to third parties. Now you can widen your horizons geographically and reach out to the ocean of possibilities before you, while you skillfully comply with regulations set forth by the relevant data protection authorities.
Split provides the equipment you need to get ahead of the swell and, dude, you’ll be ripping up the waves.
Check out the full code on GitHub, with a shaka thrown to Javier Avrudsky on the Split SDK Team for some great code reviews.
Get Split Certified
Split Arcade includes product explainer videos, clickable product tutorials, manipulatable code examples, and interactive challenges.
Switch It On With Split
Split gives product development teams the confidence to release features that matter faster. It’s the only feature management and experimentation solution that automatically attributes data-driven insight to every feature that’s released—all while enabling astoundingly easy deployment, profound risk reduction, and better visibility across teams. Split offers more than a platform: It offers partnership. By sticking with customers every step of the way, Split illuminates the path toward continuous improvement and timely innovation. Switch on a trial account, schedule a demo, or contact us for further questions.