IOS SDK

Last updated March 30, 2021

Introduction

The purpose of this manual is to provide all the information required to install and use the tools developed for the iOS platform.

This SDK is written in ObjC, it gathers device data (information and location) and sends it to ClearSale. The data gathered will be related solely to the device and is unrelated to the integrated app.

Geolocation data depends on permission granted by the device user. This means the app must request access to user location data (the SDK does not ask for permission). If the app does not request access, or if the user denies permission, the data will not be gathered.

SDK respects Apple's privacy policy in terms of gathering device data and the level of permission granted by the device user.

iOS

Package Installation

  • CocoaPods

The pod is available in a private repository. Use requires following the example below for PodFile:

A token must be requested for download.

source	'https://csbehaviorsdk:TOKEN@dev.azure.com/vstscs/Produtos-Agile/_git/BehaviorAnalytics.SDK.IOS.Specs'

use_frameworks!

target 'PROJECT_NAME' do
'CSBehavior', '3.0.1' pod

end

 

  • CocoaPods

O pod está disponível em um repositório privado, e para sua utilização seguir o exemplo abaixo para o PodFile:

É necessário solicitar o token para download.

source	'https://csbehaviorsdk:TOKEN@dev.azure.com/vstscs/Produtos-Agile/_git/BehaviorAnalytics.SDK.IOS.Specs'

use_frameworks!

target 'NOME_DO_PROJETO' do
pod 'CSBehavior', '3.0.2-rc.1'

end

 

Esta versão de pacote está depreciado. Recomendamos usar a versão mais atualizada no menu de versões para iOS.

Configuration

Instructions for configuring the framework in the project:

  1. Open the project editor and select the project, on the "Build Settings" tab add the "-ObjC" flag to the "Other Linker Flags" setting.
  2. Add the following entries to the destination project Info.plist file:

 

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>clearsale.com.br</key>
        <dict>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
        </dict>
    </dict>
</dict>
For projects developed in Objective-C, import @import CSBehavior; in the file where you want to use the framework.
For projects develop in Swift, import <CSBehavior/CSBehavior.h> in the project bridging header.
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>

if (@available(iOS 14, *)) {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    }];
}
Swift:
import AppTrackingTransparency
...
if #available(iOS 14, *) {
    ATTrackingManager.requestTrackingAuthorization { _ in
    }
}

Class CSBehavior

Description

CSBehavior is the class responsible for data gathering.

Builders

This class has no public builders. The instance must be made using a static method.


Static Methods
Method name Description
(CSBehavior *)getInstance:(NSString *)toApp Obtains the CSBehavior class instance for an AppKey.
The AppKey (provided by ClearSale) must be given as a parameter.

Methods

 

Method name Description
(NSString *)generateSessionId Generates and returns a session identifier.
This method should be used only if the app does not generate unique identifiers for each data gathering.

(void)collectDeviceInformation:(NSString *)toSessionId Gathers data on the device linked to the Session value.
SessionId, the session value, must be provided as a parameter.
  • If that SessionID has no unique value use generateSessionId().
  • The maximum SessionID is 128 characters.
  • The minimum SessionID is 6 characters.
  • An exception will be created if the SessionID value is not valid.

 

Examples

ObjC with SessionId value.
CSBehavior *behavior = [[CSBehavior getInstance] @"APP_KEY" ]
[behavior collectDeviceInformation: @"SESSION_ID"]

ObjC with no SessionId value.
CSBehavior *behavior = [[CSBehavior getInstance] @"APP_KEY" ]
NSString *sessionId =  [behavior generateSessionId]
[behavior collectDeviceInformation:sessionId]

Swift with SessionId value
Behavior var: CSBehavior = CSBehavior.getInstance("APP_KEY");
behavior.collectDeviceInformation("SESSION_ID")

Swift with SessionId value
Behavior var: CSBehavior = CSBehavior.getInstance("APP_KEY");
SessionId var: NSString = behavior.generateSessionId();
behavior.collectDeviceInformation(sessionId);

Privacy details

Data use

All of the data collected by the ClearSale SDK shall be used exclusively for fraud prevention and user protection. It complies with Google and Apple security and privacy policies as well as GDPR. For this reason, this information must be part of the app's privacy policy.

Type of data collected

ClearSale's SDK gathers the following data from the device.

  • Accurate location (when enabled under user permissions)
  • Device advertising identifiers (when enabled under user permissions)
  • Physical characteristics of the device/hardware (e.g. screen, battery, keyboard, free disc space, device name and model) and software (e.g. version, language, build, parental controls), along with network information such as connections, IP and SimCard operator (carrier).

User License

By downloading and using our SDK you are agreeing to the following license.

Copyright © 2021 ClearSale

All rights reserved. This license grants permission to use the software "as is". The software may not be modified or copied for any purpose. The Software is licensed as configured and with absolutely no expressed or implicit guarantee, including but not limited to marketing guarantees, suitability for specific purposes and non-violation of patented rights. Under no circumstances may the owners of the Copyright be held liable for damages, losses, basis for lawsuits due to contract or illegal acts or any other illegal means arising from the use of the Software or other actions related to this Software without the prior written authorization of the copyright holders.