This method is used to initialize the user in applications where you have set calculation by user ID specified by the developer, applications that are part of a cross-platform project.
You can also use this method when calculating by device ID (by default) to pass in the user ID used on your servers so that you can easily find the user on devtodev.
We recommend that you pass this parameter in the initialization configuration (userId property of an instance of theDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the setUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the setUserId method.
DTDAnalytics.setUserId(userId:"Custom User ID")
To get the current value of the user ID, use the asynchronous method
getDeviceId(_ completionHandler: @escaping (String) -> Void)
DTDAnalytics.getUserId { userId in// your code}
We recommend that you pass this parameter in the initialization configuration (userId property of an instance of theDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the setUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the setUserId method.
[DTDAnalytics userId:@"Custom User ID"];
To get the current value of the user ID, use the asynchronous method
(void)deviceIdHandler:( void (^ _Nonnull)(NSString * _Nonnull))completion-Handler;
[DTDAnalytics userIdHandler:^(NSString * _Nonnull userId) {
// your code
}];
We recommend that you pass this parameter in the initialization configuration (userId property of an instance of theDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the setUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the setUserId method.
DTDAnalytics.setUserId(userId: "Custom User ID")
To get the current value of the user ID, use the asynchronous method
getDeviceId(block: (String) -> Unit)
DTDAnalytics.getUserId { userId ->// your code}
We recommend that you pass this parameter in the initialization configuration (userId property of an instance of theDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the SetUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the SetUserId method.
DTDAnalytics.SetUserId(userId:"Custom User ID")
To get the current value of the user ID, use the asynchronous method:
var userId =awaitDTDAnalytics.GetUserId();
We recommend that you pass this parameter in the initialization configuration (userId property of an instance of theDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the SetUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the SetUserId method.
DTDAnalytics.SetUserId(userId:"Custom User ID")
To get the current value of the user ID, use the asynchronous method:
DTDAnalytics.GetUserId(id =>{ //your code});
We recommend that you pass this parameter in the initialization configuration (userId property in config object).
Do not pass an empty string ("") to the setUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use the setUserId method.
window.devtodev.setUserId("Custom User ID")
To get the current value of the user ID, use the getUserIdmethod
var userId =window.devtodev.getUserId()
We recommend that you pass this parameter in the initialization configuration (UserId property of an instance of the FDTDAnalyticsConfiguration class).
Do not pass an empty string ("") to the SetUserID method as the user ID. Assigning an empty string is a command to assign a default value to the user ID (it is equal to the current device ID). In applications with calculation by user ID, this can lead to unnecessary registrations.
To set a new value as the user ID, use method:
UDTDAnalyticsBPLibrary::SetUserId("Name");
To get the current value of the user ID, use the asynchronous method:
auto onResult =newFDTDGetterStringDelegate();onResult->BindLambda([](const FString& value){ // Your code...});UDTDAnalyticsBPLibrary::GetUserId(*onResult);
Replace
This method is used in very rare cases. It is applicable in the case when the calculation of users in the project is carried out by the user ID specified by the developer. In this case, the application can change this identifier. For example, calculation in the application is carried out by user emails and in the application, it is possible to change this email to another one. At the time of replacement, you need to call this method, specifying the user's previous email and the one with which it was replaced.
DTDAnalytics.replace(fromUserId:"Old user id", toUserId:"New user id")
[DTDAnalytics replaceFromUserId:@"Old user id" toUserId:@"New user id"];
DTDAnalytics.replace(fromUserId: "Old user id", toUserId: "New user id")
DTDAnalytics.Replace(fromUserId:"Old user id", toUserId:"New user id");
DTDAnalytics.Replace(fromUserId:"Old user id", toUserId:"New user id");
window.devtodev.replace( "Old user id","New user id")
Do not use this method to re-login as a different user! The setUserId method is used for relogging.
Current user level
This method is used in cross-platform and data synchronized applications.
The method is required to update user level data.
To set the current value to the user level, use setCurrentLevel(currentLevel: Int) method:
DTDAnalytics.setCurrentLevel(value:2)
We recommend that you use the setCurrentLevel method immediately after using the setUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the setCurrentLevel method when the user reaches a new level. In this case, you must use the levelUp method.
To get the user-level value stored by the SDK, use getCurrentLevel(completionHandler: @escaping (Int) -> Void) method
DTDAnalytics.getCurrentLevel { level in// your code}
To set the current value to the user level, use (void)currentLevel:(NSInteger)currentLevel; method:
[DTDAnalytics currentLevel:2];
We recommend that you use the setCurrentLevel method immediately after using the setUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the setCurrentLevel method when the user reaches a new level. In this case, you must use the levelUp method.
To get the user-level value stored by the SDK, use (void)currentLevelHandler:( void (^ _Nonnull)(NSInteger))completionHandler; method
[DTDAnalytics currentLevelHandler:^(NSInteger level) {
// your code
}];
To set the current value to the user level, use method:
DTDAnalytics.setCurrentLevel(value:2)
We recommend that you use the setCurrentLevel method immediately after using the setUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the setCurrentLevel method when the user reaches a new level. In this case, you must use the levelUp method.
To get the user-level value stored by the SDK, use getCurrentLevel(completionHandler: @escaping (Int) -> Void) method
DTDAnalytics.getCurrentLevel { level ->// your code}
To set the current value to the user level, use method:
DTDAnalytics.SetCurrentLevel(level:3);
We recommend that you use the SetCurrentLevel method immediately after using the SetUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the SetCurrentLevel method when the user reaches a new level. In this case, you must use the LevelUp method.
To get the user-level value stored by the SDK, use GetCurrentLevel method:
var currentLevel =awaitDTDAnalytics.GetCurrentLevel();
To set the current value to the user level, use method:
DTDAnalytics.SetCurrentLevel(level:3);
We recommend that you use the SetCurrentLevel method immediately after using the SetUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the SetCurrentLevel method when the user reaches a new level. In this case, you must use the LevelUp method.
To get the user-level value stored by the SDK, use GetCurrentLevel method:
To set the current value to the user level, use method:
window.devtodev.setCurrentLevel(2)
We recommend that you use the setCurrentLevel method immediately after using the setUserID method or specify the current user level in the initialization configuration (the level property of an instance of the DTDAnalyticsConfiguration).
Do not use the setCurrentLevel method when the user reaches a new level. In this case, you must use the levelUp method.
To get the user-level value stored by the SDK, use getCurrentLevel method.
var currentLevel =window.devtodev.getCurrentLevel()
To set the current value to the user level, use method:
UDTDAnalyticsBPLibrary::SetCurrentLevel(7);
We recommend that you use the SetCurrentLevel method immediately after using the SetUserID method or specify the current user level in the initialization configuration (the level property of an instance of the EDTDAnalyticsConfiguration).
Do not use the SetCurrentLevel method when the user reaches a new level. In this case, you must use the LevelUp method.
To get the user-level value stored by the SDK, use method:
auto onResult =newFDTDGetterIntDelegate();onResult->BindLambda([](int32 value){ // Your code...});UDTDAnalyticsBPLibrary::GetCurrentLevel(*onResult);
Cheater
If you have your own methods for detecting cheaters in the application, you can tag such users. Actions taken by these users will not be counted in statistics.
DTDUserCard.setCheater(cheater:true)
To get the current value of the 'Cheater' flag, use
getCheater(completionHandler: @escaping (Bool) -> Void)
DTDUserCard.getCheater { isCheater in// your code}
[DTDUserCard setCheater:true];
To get the current value of the 'Cheater' flag, use(void)getCheaterHandler:( void (^ _Nonnull)(BOOL))completionHandler;
[DTDUserCard getCheaterHandler:^(BOOL cheater) {
// your code
}];
DTDUserCard.setCheater(cheater: true)
To get the current value of the 'Cheater' flag, use
getCheater(handler: (Boolean) -> Unit)
DTDUserCard.getCheater { isCheater ->// your code}
DTDUserCard.SetCheater(cheater:true);
To get the current value of the 'Cheater' flag, use
var isCheater =awaitDTDUserCard.GetCheater();
DTDUserCard.SetCheater(cheater:true);
To get the current value of the 'Cheater' flag, use
DTDUserCard.GetCheater(cheater=>{ //your code});
window.devtodev.user.setCheater(true)
To get the current value of the 'Cheater' flag, use getCheater method:
var isCheater =window.devtodev.user.getCheater()
UDTDUserCardBPLibrary::SetCheater(true);
To get the current value of the 'cheater' flag, use
auto onResult =newFDTDGetterBoolDelegate();onResult->BindLambda([](bool value){ // Your code...});UDTDUserCardBPLibrary::GetCheater(*onResult);
Reserved user properties
Attention! We strongly discourage the storage of personal user data! If you plan to pass this data, be sure to indicate this in the ‘Nutrition label’ when submitting the application to the App Store review.
Attention! We strongly discourage the storage of personal user data! If you plan to pass this data, be sure to indicate this in the ‘Nutrition label’ when submitting the application to the App Store review.
Attention! We strongly discourage the storage of personal user data! If you plan to pass this data, be sure to indicate this in the ‘Nutrition label’ when submitting the application to the App Store review.
Attention! We strongly discourage the storage of personal user data! If you plan to pass this data, be sure to indicate this in the ‘Nutrition label’ when submitting the application to the App Store review.
Example:
UDTDUserCardBPLibrary::SetEmail("Email");
auto onResult = new FDTDGetterStringDelegate();
onResult->BindLambda([](const FString& value)
{
// Your code...
});
UDTDUserCardBPLibrary::GetEmail(*onResult);
Custom user property
Each devtodev project can have up to 30 custom user properties. User custom property values can be a number, a string, or a boolean value.
This is how you can set properties on the current user profile:
DTDUserCard.set(key: "key for string value", value: "string value")
DTDUserCard.set(key: "key for int value", value: 10)
DTDUserCard.set(key: "key for double value", value: 12.5)
DTDUserCard.set(key: "key for bool value", value: true)
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
DTDUserCard.getValue(key: "key for value") { value in
// your code
}
When using the getValue method, note that the Anyreturn type will need to be cast to the data type you want.
This is how you can set properties on the current user profile:
[DTDUserCard setString:@"key for string value" value:@"string value"];
[DTDUserCard setInt:@"key for int value" value:10];
[DTDUserCard setDouble:@"key for double value" value:12.5];
[DTDUserCard setBool:@"key for bool value" value:true];
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
[DTDUserCard getValueWithKey:@"key for value" :^(id object) {
// your code
}];
When using the getValue method, note that the Anyreturn type will need to be cast to the data type you want.
This is how you can set properties on the current user profile:
DTDUserCard.set(key: "key for string value", value: "string value")
DTDUserCard.set(key: "key for int value", value: 10)
DTDUserCard.set(key: "key for double value", value: 12.5)
DTDUserCard.set(key: "key for bool value", value: true)
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
getValue(key: String, handler: (Any?) -> Unit)
DTDUserCard.getValue(key: "key for value") { value ->
// your code
}
When using the getValue method, note that the Anyreturn type will need to be cast to the data type you want.
This is how you can set properties on the current user profile:
DTDUserCard.Set(key: "key for string value", value: "string value");
DTDUserCard.Set(key: "key for int value", value: 10);
DTDUserCard.Set(key: "key for double value", value: 12.5);
DTDUserCard.Set(key: "key for bool value", value: true);
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
var value = await DTDUserCard.Get(key: "key for value");
switch (value)
{
case bool boolValue:
break;
case long longValue:
break;
case double doubleValue:
break;
case string stringValue:
break;
}
When using the Get method, note that the object return type will need to be cast to the data type you want.
This is how you can set properties on the current user profile:
DTDUserCard.Set(key: "key for string value", value: "string value");
DTDUserCard.Set(key: "key for int value", value: 10);
DTDUserCard.Set(key: "key for double value", value: 12.5);
DTDUserCard.Set(key: "key for bool value", value: true);
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
DTDUserCard.GetValue("key", value =>
{
switch (value)
{
case bool boolValue:
break;
case long longValue:
break;
case double doubleValue:
break;
case string stringValue:
break;
}
})
DTDUserCard.Get(key: "key for value");
When using the Get method, note that the object return type will need to be cast to the data type you want.
This is how you can set properties on the current user profile:
window.devtodev.user.set("key for string value", "string value")
window.devtodev.user.set("key for int value", 10)
window.devtodev.user.set("key for double value", 12.5)
window.devtodev.user.set("key for bool value", true)
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use the method:
window.devtodev.user.getValue("key for value")
This is how you can set properties on the current user profile:
It is important to remember that the key for custom user properties has a length limit. If the limit is exceeded (from 1 to 64 characters), the key will be truncated to the maximum allowed length
To get the current value stored in the user profile on the SDK, you need to use methods:
FString key = FString(TEXT("Key"));
auto onResult = new FDTDGetterOptionalBoolWithKeyDelegate();
onResult->BindLambda([](bool success, const FString& key, bool value)
{
// Your code...
});
UDTDUserCardBPLibrary::TryGetBool(key, *onResult);
FString key = FString(TEXT("Key"));
auto onResult = new FDTDGetterOptionalFloatWithKeyDelegate();
onResult->BindLambda([](bool success, const FString& key, float value)
{
// Your code...
});
UDTDUserCardBPLibrary::TryGetFloat(key, *onResult);
FString key = FString(TEXT("Key"));
auto onResult = new FDTDGetterOptionalIntWithKeyDelegate();
onResult->BindLambda([](bool success, const FString& key, int64 value)
{
// Your code...
});
UDTDUserCardBPLibrary::TryGetLong(key, *onResult);
FString key = FString(TEXT("Key"));
auto onResult = new FDTDGetterOptionalStringWithKeyDelegate();
onResult->BindLambda([](bool success, const FString& key, const FString& value)
{
// Your code...
});
UDTDUserCardBPLibrary::TryGetString(key, *onResult);
Unset user property
It removes a property or a list of properties and their values from the current user profile.
DTDUserCard.unset(property: "key for string value")
DTDUserCard.unset(properties: ["key for string value",
"key for int value"])
[DTDUserCard unsetProperty:@"key for string value"];
[DTDUserCard unset:@[@"key for string value",
@"key for int value"]];
DTDUserCard.unset(property: "key for string value")
DTDUserCard.unset(properties: listOf("key for string value", "key for int value"))