Sample Code for Tealeaf iOS SDK
Instrumenting Form Completion
Privacy masking controls and migrating old privacy masking functionality to the new privacy masking functionality
Implementing AdvertisingId in your application

How to instrument Form Completion in your application

If you use OverStat in an Activity or Fragment, you must implement logFormCompletion to generate reports based on user activity within a form.
Note: This step is completely manual and will not be automated because of the different architectures that an application can have, it is difficult to instrument. The form page can also have additional custom validation that would indicate if completion was correct or not.

Example when a form is complete and ready to submit:

RLMRealm *realm = [RLMRealm defaultRealm];
[realm transactionWithBlock:^{
[realm addObject:order];
[AppManager sharedInstance].anonymousCartItems = [NSMutableArray array];
[[NSNotificationCenter defaultCenter]
postNotificationName:@"CartItemUpdated" object:self];
[self showConfirmationDialog];
[[TLFCustomEvent sharedInstance] logFormCompletion:YES
withValidData:YES];
}];

How to mask controls and migrate the old masking functionality to the new functionality

Current privacy masking functionality steps

Privacy masking functionality can be configured with “Masking” property of TealeafBasicConfig.plist file inside TLFResources.bundle

  1. Privacy masking is enabled by setting “HasMasking” under Masking property to “YES”
  2. Tealeaf iOS SDK currently supports two types of masking levels- standard level where original text is replaced with empty text (“”) and custom level where lower case character is replaced with ‘x’, upper case character is replaced with ‘X’, number is replaced with ‘9’ and special case character including white space character is replaced with ‘#’
  3. Default privacy masking is standard privacy masking. When “HasCustomMask” key is set to “YES”, custom privacy masking is enabled.
  4. To mask a control, add regular expression under “MaskIdList” property (which is under Masking property) that matches the id of the control. All the controls whose id’s matches with the regular expression will be masking based on configured masking level.

Ex: Regular expression “^9[0-9][0-9][0-9]$” matches all the controls whose id’s has four characters, start with 9 and remaining characters range from 0-9.

Migrating old privacy masking functionality to new functionality

  1. Previous version of SDK supports four levels of privacy masking which is no longer the case with current SDK version
  2. Current version of SDK will only support two levels of privacy masking- standard and custom level
  3. “TagRegex” property of TealeafBasicConfig.plist which takes comma separated regular expressions is replaced with “MaskIdList” array property that takes regular expressions as elements.
  4. Privacy masking level which is used to be set on individual elements/controls (for example: adding key UITextField with value 3 under “Masking” property will set UITextField with masking level 3) is replaced with universal level masking across the app. Privacy masking across the app is accomplished using the properties “HasMasking” and “HasCustomMask”.

How to implement AdvertisingId in your application to capture the Apple identifier for advertisers (IDFA) data

Tealeaf can capture Apple identifier for advertisers (IDFA) data using the Tealeaf AdvertisingId property. The IDFA is a unique, user-resettable ID for advertising. The IDFA gives users better controls and provides developers with a standard system to continue to monetize their apps. The IDFA also gives users the ability to reset their identifier or opt out of personalized ads within an application.

Add the advertisingId property to the mobileEnvironment section of your application and define the value for the advertisingId.

Example:

"clientEnvironment": {
        "mobileEnvironment": {
            "android": {
                "keyboardType": 2,
                "brand": "generic",
                "fingerPrint":
      "generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys"
            },
            "totalMemory": 63422464,
            "totalStorage": 12288,
            "orientationType": "PORTRAIT",
            "appVersion": "1.0.5",
            "manufacturer": "unknown",
            "deviceId": "11111111111111111111111111111111",
            "advertisingId": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY",
            "locale": "English (United States)",
            "deviceModel": "sdk",
            "language": "English"
        },
        "width": 0,
        "height": 0,
        "osVersion": "2.2"
    }

If the end user has chosen to opt out of ads, advertisingId returns the following value:

“advertisingId”: “N/A”


Join The Discussion

Your email address will not be published. Required fields are marked *