User consent

User privacy is a central concern of Inloco. Regulations such as the General Data Protection Regulation (GDPR) require application developers to ask for permission before collecting user data. Inloco SDK provides a mechanism to handle this in a user friendly way.

💬Asking for the user consent

The Inloco SDK provides a way to delay data collection until the user has given privacy consent.

To wait for the user's privacy consent, you must set privacyConsentRequired to YES on the InLocoOptions.plist file. By doing this, the SDK will be initialized without data collection.

To check if a given set of consents has been explicitly set, the following method can be used. If the consents are missing, it is necessary to show the privacy policy to the user explaining why those consent types are needed and what benefits are available with the granted consents.

Swift
Objective-C
Swift
/**
Returns through a block a Object containing the informations bellow:
- isWaitingConsent: Return true if any consent has not been settled, and false if all consents are either GIVEN or DENIED
- areAllConsentTypesGiven: Return true if all requested consents were given, otherwise returns false
- hasFinished: If the operation has finished or was incomplete due to any error that occurred. Returns true if the operation has finished and false if any exception was thrown in the process.
*/
ILMInLoco.checkConsent(forTypes: [
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION,
]) { (result: ILMConsentResult?) in
guard let result = result else {
// Some error occurred during the process and the operation could not be finished
print("Error")
return
}
if !result.hasFinished() {
// Some error occurred during the process and the operation could not be finished
print("Error")
} else if result.areAllConsentTypesGiven() {
// All consents passed as parameters have been previously accepted by the user
print("Success!")
} else {
// At least one consent passed as parameter was denied by the user
print("Success, but user denied.")
}
}
Objective-C
/**
Returns through a block a Object containing the informations bellow:
- isWaitingConsent: Return true if any consent has not been settled, and false if all consents are either GIVEN or DENIED
- areAllConsentTypesGiven: Return true if all requested consents were given, otherwise returns false
- hasFinished: If the operation has finished or was incomplete due to any error that occurred. Returns true if the operation has finished and false if any exception was thrown in the process.
*/
[ILMInLoco checkConsentForTypes:[NSSet setWithArray: @[
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
]
] withBlock:^(ILMConsentResult *result){
if (result) {
if (![result hasFinished]) {
//Some error occurred during the process and the operation could not be finished
NSLog(@"Error");
} else if ([result areAllConsentTypesGiven]) {
// All consents passed as parameters have been previously accepted by the user
NSLog(@"Success!");
} else {
// At least one consent passed as parameter was denied by the user
NSLog(@"Success, but user denied.");
}
}
}];

After the user agrees to the privacy policy, one of the following methods must be called to allow or deny the SDK to begin collecting data:

Option 1:

Request privacy consent using Inloco's customized dialog

🧠Note: This is a consent dialog provided by Inloco but you can use your own consent dialog if you want.

The SDK provides a method that presents to the user a customized Dialog for consent request. If the user allows it, it will give the privacy consent for the consent types present on the given parameters. Otherwise, it will deny consent for the given consent types.

The dialog will appear only if the SDK is waiting for the user consent.

Swift
Objective-C
Swift
let consentTypes: Set = [ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION]
let builder = ILMConsentDialogOptionsBuilder()
builder.title = "title text"
builder.message = "message text"
builder.acceptText = "accept text"
builder.denyText = "refuse text"
builder.consentTypes = consentTypes
let dialogOptions = builder.build(nil)
ILMInLoco.requestPrivacyConsent(with: dialogOptions) { (result: ILMConsentResult?) in
guard let result = result else {
// Some error occurred during the process and the operation could not be finished
print("Error")
return
}
if !result.hasFinished() {
// Some error occurred during the process and the operation could not be finished
print("Error")
} else if result.areAllConsentTypesGiven() {
// The dialog was shown and the consent was given
print("Success!")
} else {
// The dialog was shown but the consent was denied
print("Success, but user denied.")
}
}
Objective-C
ILMConsentDialogOptions *dialogOptions = [[ILMConsentDialogOptions alloc] init];
[dialogOptions setTitle:@"title text"];
[dialogOptions setMessage:@"message text"];
[dialogOptions setAcceptText:@"accept text"];
[dialogOptions setDenyText:@"deny text"];
[dialogOptions setConsentTypes:[
NSSet setWithArray: @[
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
]
]];
[ILMInLoco requestPrivacyConsentWithOptions:dialogOptions
andConsentBlock:^(ILMConsentResult *result){
NSLog(@"Operation has finished?: %d", [result hasFinished]);
NSLog(@"Are all consent types given?: %d", [result areAllConsentTypesGiven]);
NSLog(@"Is missing consent?: %d", [result isWaitingConsent]);
}
];

Option 2:

allowConsentTypes

This method allows consent for the functionality types specified in the array. It should be used to enable functionalities in case the user has not given consent in the previous dialog.

Swift
Objective-C
Swift
// This call should be made in your code after the user has given privacy consent
ILMInLoco.allowConsentTypes([
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
])
Objective-C
// This call should be made in your code after the user has given privacy consent
[ILMInLoco allowConsentTypes:
[NSSet setWithArray: @[
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
]
]];

Option 3:

setAllowedConsentTypes

This method is similar to calling [ILMInLoco allowConsentTypes:] but all other predefined consent types not present in the array are considered denied by the user.

Swift
Objective-C
Swift
// This call should be made in your code after the user has given privacy consent
ILMInLoco.setAllowedConsentTypes([
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
])
Objective-C
// This call should be made in your code after the user has given privacy consent
[ILMInLoco setAllowedConsentTypes:
[NSSet setWithArray: @[
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
]
]];

The privacy consent setting is persisted and requestPrivacyConsentWithOptions or setAllowedConsentTypes can be called just once. If the privacy consent is given, the following SDK initializations will start with data collection enabled.

🧩 Consent types

Name

Description

Plan

ILM_CONSENT_TYPE_LOCATION

Enables the collection of location data from users.

Free

ILM_CONSENT_TYPE_ENGAGE

Enables the usage of location data to send push notifications.

Free, Pro

ILM_CONSENT_TYPE_CONTEXT_PROVIDER

Enables the context data delivery for engagement actions or analysis.

Enterprise

If you wish to use all or none of them, you can use one of the following variables:

Name

Description

ILM_CONSENT_SET_ALL

Enable all consent types.

ILM_CONSENT_SET_NONE

Disable all consent types.

🧠Note: It is important to notice that without data collection, features won't be enabled for the user. For example, it won't be possible to send localized push notifications without location data.

🚧Attention: The default value of inloco_privacy_consent_required is false. It means that not setting this property will make the SDK start data collection right away and you need to ask the user consent through your app's Privacy Policy. In following SDK versions, this setting will be removed and consent will be always required.

It is also possible for the user to revoke a privacy consent previously given. When this happens, you should call denyConsentTypes.

Swift
Objective-C
Swift
// This call should be made in your code after the user has revoked a previously given privacy consent
ILMInLoco.denyConsentTypes([
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
])
Objective-C
// This call should be made in your code after the user has revoked a previously given privacy consent
[ILMInLoco denyConsentTypes:[
NSSet setWithArray: @[
ILM_CONSENT_TYPE_CONTEXT_PROVIDER,
ILM_CONSENT_TYPE_ENGAGE,
ILM_CONSENT_TYPE_EVENTS,
ILM_CONSENT_TYPE_LOCATION
]
]];