Links

iOS

CocoaPods

CocoaPods is the easiest way to add devtodev into your iOS project.
1. Firstly, install CocoaPods using:
sudo gem install cocoapods
2. In the project directory execute the command:
pod init
3. In the created Podfile add the dependency:
platform :ios, '9.0'
target 'TargetName' do
use_frameworks!
pod 'DTDAnalytics', '~> 2.0.0'
end
4. Finally, run the command in your Xcode project directory:
pod install
CocoaPods should download and install the devtodev library, and create a new Xcode workspace. Open this workspace in Xcode.

Swift Package Manager

In progress...

Manual installation

2. Add DTDAnalytics.xcframework to the project (with Do Not Embed specified)
3. Add frameworks:
  • AppTrackingTransparency.framework
  • AdSupport.framework
4. Add initialization todidFinishLaunchingWithOptions method:
Swift
Objective-C
let config = DTDAnalyticsConfiguration()
config.logLevel = .error
DTDAnalytics.initialize(applicationKey: "App ID", configuration: config)
DTDAnalyticsConfiguration *config = [[DTDAnalyticsConfiguration alloc] init];
config.logLevel = DTDLogLevelError;
[DTDAnalytics applicationKey:@"App ID" configuration:config];
  • An App ID can be found in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
  • config - an object instance of DTDAnalyticsConfiguration, which is used for specifying additional properties during the initialization.
DTDAnalyticsConfiguration
Parameter
Type
Description
currentLevel
int
The player level at the moment of devtodev SDK initialization. It is recommended (but optional) to use to improve data precision.
userId
string
A custom user identifier provided by the developer. If you utilize the default calculation by the device ID, this identifier can be used for finding a user in devtodev.
In case your project utilizes the calculation by the user identifier, you must set this parameter because it becomes the main user identifier in devtodev.
trackingAvailability
DTDTrackingStatus (enum)
The property allows or disallows devtodev tracking of the user. By default, it is set to DTDTrackingStatus.enable. SDK stores the previously assigned value. Pass DTDTrackingStatus.disable if the user opted out of tracking in line with GDPR.
logLevel
DTDLogLevel (enum)
The level of logging the SDK activity. The DTDLogLevel.no value is used by default. For troubleshooting during integration it is recommended to set it to DTDLogLevel.debug, and either switch it off DTDLogLevel.no or use it only for error handling DTDLogLevel.error in the release version.
Example:
Swift
Objective-C
let config = DTDAnalyticsConfiguration()
config.currentLevel = 1
config.userId = "CustomUserID"
config.trackingAvailability = .enable
config.logLevel = .error
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
DTDAnalyticsConfiguration *config;
config.currentLevel = @1;
config.userId = @"CustomUserID";
config.trackingAvailability = DTDTrackingStatusEnable;
config.logLevel = DTDLogLevelError;
[DTDAnalytics applicationKey:@"App ID" configuration:config];

Integration features

For Objective-C

  1. 1.
    Create Bridging-Header. To do this, you need to add any swift file to the project (don’t delete it later) and choose ‘Create Bridging Header’ in the offered dialog box.
  2. 2.
    Make sure that the ‘Build Settings’ for ‘Defines Module’ value evaluates to ‘YES’.
  3. 3.
    While importing, use: #import <DTDAnalytics/DTDAnalytics-Swift.h>

For SwiftUI

For SDK to function properly, it needs to be integrated at the earliest moment of the app launch. It is recommended that you use the following method of main entry point initialization:
@main
struct TestSwiftUIApp: App {
init() {
let config = DTDAnalyticsConfiguration()
config.logLevel = .debug
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

Apps targeted at children

When developing and publishing apps targeted at children under 13 years old, you need to ensure special conditions for data processing. Any mobile app aimed at children or intended for users in a region with strict regulations on child online protection, must comply with current laws.
If your app has to comply with the legal requirements (COPPA), use the following recommendations:
  1. 1.
    Implement the coppaControlEnable method. The method disables collection of ad IDs and vendor IDs (IDFA, IDFV).
  2. 2.
    To comply with Apple’s guidelines
    1. 1.
      Remove AppTrackingTransparency.framework and all the links pointing to it.
    2. 2.
      Remove AdSupport.framework all the links pointing to it.
Call the coppaControlEnable method before SDK initialization. If the method was not called, the SDK will work as before.
Swift
Objective-C
DTDAnalytics.coppaControlEnable()
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
[DTDAnalytics coppaControlEnable];
[DTDAnalytics applicationKey:@"App ID" configuration:config];
Last modified 2mo ago