macOS
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
1
let config = DTDAnalyticsConfiguration()
2
config.logLevel = .error
3
DTDAnalytics.initialize(applicationKey: "App ID", configuration: config)
Copied!
1
DTDAnalyticsConfiguration *config;
2
config.logLevel = DTDLogLevelError;
3
[DTDAnalytics applicationKey:@"App ID" configuration:config];
Copied!
  • 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
1
let config = DTDAnalyticsConfiguration()
2
config.currentLevel = 1
3
config.userId = "CustomUserID"
4
config.trackingAvailability = .enable
5
config.logLevel = .error
6
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
Copied!
1
DTDAnalyticsConfiguration *config;
2
config.currentLevel = @1;
3
config.userId = @"CustomUserID";
4
config.trackingAvailability = DTDTrackingStatusEnable;
5
config.logLevel = DTDLogLevelError;
6
[DTDAnalytics applicationKey:@"App ID" configuration:config];
Copied!

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:
1
@main
2
struct TestSwiftUIApp: App {
3
init() {
4
let config = DTDAnalyticsConfiguration()
5
config.logLevel = .debug
6
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
7
}
8
9
var body: some Scene {
10
WindowGroup {
11
ContentView()
12
}
13
}
14
}
Copied!
Last modified 8mo ago
Export as PDF
Copy link