DataDome iOS Legacy SDK


Installation (Swift 5+ compiler)

CocoaPods

If you have Alamofire 5 installed and being used in your project, install the DataDomeSDK 1.x.18+ where x is your Xcode version (1.117.18 for Xcode 11.7 or 1.120.18 for Xcode 12.0 etc.)

platform :ios, '13.0'
use_frameworks!

pod 'DataDomeSDK', '~> 1.117.18'

1 - Network Tracking & Captcha

We support 3 HTTP clients (please follow the links below to integrate DataDome with your client):

We also have provide manual integration (please refer to the link below):

  • Manual Integration
    (We strongly recommend using URLSession, Moya or Alamofire integration whenever possible.)

2 - Event Tracking

We provide 2 event tracking types:

  • Touch screen tracking
  • Custom event tracking

Touch Screen Event tracking

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    dataDomeSdk?.handleTouchEvent(touches, offType: .down, inView: self.view)
}

Custom event Tracking

// Use your sdk instance to log custom event
dataDomeSdk.logEvent(id: 123, message: "My event message", source: "The event source")

Optional Settings

Using custom Accept header

By default, DataDome SDK overrides the default Accept header for each API call to JSON.
Please follow the 2 steps below to change this behavior:

1 - Inside the Mobile app

Set the parameter bypassAcceptHeader to true in your instance of the SDK:

override func viewDidLoad() {
    
    super.viewDidLoad()
  
    // Init
    dataDomeSdk = DataDomeSDK(containerView: containerView, key: "Client_Side_Key", appVersion: appVersion, userAgent: useragent, bypassAcceptHeader: true)

    // OR
    datadomeSdk.bypassAcceptHeader = true
}

2 - DataDome Dashboard

Force the response format inside the mobile app endpoint settings to JSON.