Client Attributes
Optional
In some cases, the Host application may need to pass attributes to the DR SDK. This is supported with the ClientAttributes class provided as a part of the SDK.
The following code snippet shows how this can be done.
Avoid Data Override
Please note that all values need to be passed together to the SDK before the
setClientAttributes
method is called. By calling multiple times the previous data would be overwritten and only the new value would be available and sent to DR servers.
// Set Client Attributes to be sent to DR SDK
// Set necessary values
NSDictionary<NSString *,NSString *> *attributes =
[NSDictionary dictionaryWithObjectsAndKeys:@"Value1", @"Param1",
@"Value2", @"Param2", nil];
// Pass the values to the DR SDK.
[DigitalReef.shared setClientAttributesWithAttributes:attributes];
//Set and pass the client attributes to DR SDK
DigitalReef.shared.setClientAttributes(attributes: [
"Param1": "Value1",
"Param2": "Value2"])
The following are the keys which we have pre-defied.
- Phone number - "PHONE_NUMBER"
- Carrier - "CARRIER"
- Bill type - "BILL_TYPE" // POSTPAY or PREPAY.
In addition to the keys above you are free to add your own keys, DR would be storing the information in DB for future reference.
// Example 1 - setting the phone number
NSDictionary<NSString *,NSString *> *attributes =
[NSDictionary dictionaryWithObjectsAndKeys:
@"9857291031", @"PHONE_NUMBER",
@"Airtel", @"CARRIER",
@"Postpaid", @"BILL_TYPE", nil];
[DigitalReef.shared setClientAttributesWithAttributes:attributes];
// Example 2 - setting the bill type and custom key
NSDictionary<NSString *,NSString *> *attributes =
[NSDictionary dictionaryWithObjectsAndKeys:
@"POSTPAY", @"BILL_TYPE",
@"New value", @"New key", nil];
[DigitalReef.shared setClientAttributesWithAttributes:attributes];
// Example 1 - setting the phone number
DigitalReef.shared.setClientAttributes(attributes: [
"PHONE_NUMBER": "1234567890",
"CARRIER": "JIO",
"BILL_TYPE": "postpaid"])
// Example 2 - setting the bill type and custom key
DigitalReef.shared.setClientAttributes(attributes: [
"BILL_TYPE": "POSTPAY",
"New key" : "New value" ])
External ID
We can set the Partner ID or External ID or Host App reference ID using the Client Attributes.
For this we have reserved a KEY as "EXTERNAL_ID".
Example:
// Example 3 - setting the External ID
NSDictionary<NSString *,NSString *> *attributes =
[NSDictionary dictionaryWithObjectsAndKeys:
@"[email protected]", @"EXTERNAL_ID", nil];
[DigitalReef.shared setClientAttributesWithAttributes:attributes];
DigitalReef.shared.setClientAttributes(attributes: ["EXTERNAL_ID": "[email protected]"])
Updated 6 months ago