Form tracking lets you collect in-depth input information from users. It also lets you know if a user filled out (this will show as filled out or the value of the field) a particular form field or not (will show an empty value). 

Form tracking is available in native iOS applications as of iOS SDK version 5.0.3. Please note that form tracking with the iOS SDK only works if you are using UIKit for your forms.

Trackable Field Types

Currently, the input for the following field types can be tracked:

  • EditText
    • Plain
    • Multiline
    • Email
    • Numbers and punctuation
    • Phone
    • Secure text entry
    • Number
    • Number (decimal)
    • URL
  • Time
  • Date
  • Date and time
  • Switch
  • Segmented control

  • Countdown timer

Methods and Properties

Name of Function

- (NSError *)formTracking:(MIFormParameters *)formParams
JFX
AttributeDescriptionMandatory
MIFormParametersAdditional settings to customize form trackingyes


Configuration

Set the form tracking configuration.

  • formName: By default, the name of the current activity or view is used as the name of the form. Use this function to specify a different name for the form.
  • fieldIds: If you want to track only specific fields of the form, indicate them here. Otherwise, all trackable fields of the current activity or view are tracked.
  • renameFields: By default, the name of the field ID is used to generate the name of the field. If you want to change the default name you can specify this here.
  • changeFieldsValue: By default, the value of the text field is used as the value of the field. You can change the default value here. Please be aware that if hardcoded, the field value is changed permanently and does not indicate anymore if a field was left empty.
  • anonymousSpecificFields: By default, only EditText fields are anonymized and sent as filled out or empty to the tracking server, instead of displaying the actual value of the field. If other field types need to be anonymized, you can indicate them here.
  • fullContentSpecificFields: By default, the SDK sends EditText fields anonymized (filled out / empty) to Mapp Intelligence. If you want to send the actual content of the specific fields instead, indicate them here.
  • confirmButton: If you want to indicate that a form has been submitted or canceled, you can set the confirmButton to true or false. By default, the confirmButton is set to true.
  • anonymous: If you want to anonymize all field types, set anonymous to true.
  • pathAnalysis: You can track the order in which the user has filled out the fields. Please note that you need to track the order manually and parse the data to the fieldsOrder function. Mapp Intelligence cannot track the order in which the user filled out the form automatically.
@interface MIFormParameters : NSObject
@property (nonatomic, nullable) NSString* formName;
@property (nonatomic, nullable) NSMutableArray<NSNumber*>* fieldIds;
@property (nonatomic, nullable) NSMutableDictionary* renameFields;
@property (nonatomic, nullable) NSMutableDictionary* changeFieldsValue;
@property (nonatomic, nullable) NSMutableArray<NSNumber*>* anonymousSpecificFields;
@property (nonatomic, nullable) NSMutableArray<NSNumber*>* fullContentSpecificFields;
@property (nonatomic) BOOL confirmButton;
@property (nonatomic, nullable) NSNumber* anonymous;
@property (nonatomic, nullable) NSMutableArray<NSNumber*>* pathAnalysis;
@end
CPP

Example

// set form tracking config for confirmation and cancellation of form
class FormViewController: UIViewController {
	
	override func viewDidLoad() {
        super.viewDidLoad()
        
        name1TextField.tag = 11
        name2TextField.tag = 22
        name3TextView.tag = 33
        switchButton.tag = 44
        anonymousSwitch.tag = 55
        testPickerView.tag = 66
        testSegmentedControl.tag = 77
        
        //add accessibility labels
        name1TextField.accessibilityLabel = "firstTextField"
        name2TextField.accessibilityLabel = "secondTextField"
        name3TextView.accessibilityLabel = "firstTextView"
        switchButton.accessibilityLabel = "firstSwitchButton"
        testPickerView.accessibilityLabel = "firstPicker"
        testSegmentedControl.accessibilityLabel = "testSegment"
        
        view.isUserInteractionEnabled = true
        let tap = UITapGestureRecognizer(target: view, action: #selector(UIView.endEditing))
        view.addGestureRecognizer(tap)
    }
	@IBAction func confirmButtonPressed(_ sender: Any) {
        let parameters = MIFormParameters();
		parameters.formName = "test123"
        parameters.confirmButton = true
        parameters.anonymous = true
		parameters.fullContentSpecificFields = [33]
		parameters.anonymousSpecificFields = [55]
        MappIntelligence.shared()?.formTracking(parameters)
    }
    
    @IBAction func cancelButtonPressed(_ sender: Any) {
        let parameters = MIFormParameters();
		parameters.formName = "test123"
        parameters.fullContentSpecificFields = [11,33]
		parameters.anonymousSpecificFields = [66]
        parameters.confirmButton = false
        parameters.anonymous = true
        MappIntelligence.shared()?.formTracking(parameters)
    }
}
 
// configure form name
let parameters = MIFormParameters();
parameters.formName = "My Form"
MappIntelligence.shared()?.formTracking(parameters)
 
// congfigure to track only specific fields
let parameters = MIFormParameters();
parameters.fieldIds = [11,33]
MappIntelligence.shared()?.formTracking(parameters)
 
// rename fields
let parameters = MIFormParameters();
parameters.renameFields = [11:"rename_field1"]
MappIntelligence.shared()?.formTracking(parameters)
 
// anonymise specific fields
let parameters = MIFormParameters();
parameters.anonymousSpecificFields = [66]
MappIntelligence.shared()?.formTracking(parameters)
 
// anonymise all fields
let parameters = MIFormParameters();
parameters.anonymous=true
MappIntelligence.shared()?.formTracking(parameters)
 
// show full content of specific fields
let parameters = MIFormParameters();
parameters.fullContentSpecificFields=[33,11]
MappIntelligence.shared()?.formTracking(parameters)
 
// change value of fields
let parameters = MIFormParameters();
parameters.changeFieldsValue = [22:"changed_value1"]
MappIntelligence.shared()?.formTracking(parameters)
 
// set confirm button to false
let parameters = MIFormParameters();
form.confirmButton=false
MappIntelligence.shared()?.formTracking(parameters)
 
// track path analysis
let parameters = MIFormParameters();
parameters.pathAnalysis = NSMutableArray(array: [33,11,55,11,44])
MappIntelligence.shared()?.formTracking(parameters)
JAVA
// set form tracking config for confirmation and cancellation of form
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //set tags to easier locate fields at form
    [_textfield1 setTag:11];
    [_textField2 setTag:22];
    [_textFied3 setTag:33];
    [_textField4 setTag:44];
    [_textField5 setTag:55];
    [_textField6 setTag:66];
}

- (void)confirmButtonClicked {
    MIFormParameters* parameters = [[MIFormParameters alloc] init];
    [parameters setFormName:@"test123"];
    [parameters setConfirmButton:YES];
    [parameters setAnonymous:@YES];
    [parameters setFullContentSpecificFields:[@[ @11, @22] copy]];
    [parameters setAnonymousSpecificFields:[@[@33] copy]];
    [[MappIntelligence shared] formTracking:parameters];
}

- (void)cancelButtonClicked {
    MIFormParameters* parameters = [[MIFormParameters alloc] init];
    [parameters setFormName:@"test123"];
    [parameters setConfirmButton:NO];
    [parameters setAnonymous:@YES];
    [parameters setFullContentSpecificFields:[@[ @11, @22] copy]];
    [parameters setAnonymousSpecificFields:[@[@33] copy]];
    [[MappIntelligence shared] formTracking:parameters];
}


@end
 
// Configure form name
MIFormParameters* parameters = [[MIFormParameters alloc] init];
[parameters setFormName:@"test123"];
[[MappIntelligence shared] formTracking:parameters];
 
// Configure to track only specific fields
MIFormParameters* parameters = [[MIFormParameters alloc] init];
[parameters setFieldIds:[@[@44, @55] copy]];
[[MappIntelligence shared] formTracking:parameters];
 
// Rename fields
MIFormParameters* parameters = [[MIFormParameters alloc] init];
[parameters setRenameFields:@{@44: @"rename_field1"}];
[[MappIntelligence shared] formTracking:parameters];
 
// Anonymize specific fields
MIFormParameters* parameters = [[MIFormParameters alloc] init];
[parameters setAnonymousSpecificFields:[@[@33] copy]];
[[MappIntelligence shared] formTracking:parameters];
 
// Anonymize all fields
FormTrackingSettings form = new FormTrackingSettings();
[parameters setAnonymous:@YES];
[[MappIntelligence shared] formTracking:parameters];
 
// Show full content of specific fields
FormTrackingSettings form = new FormTrackingSettings();
[parameters setFullContentSpecificFields:[@[ @11, @22] copy]];
[[MappIntelligence shared] formTracking:parameters];
 
// Change value of fields
FormTrackingSettings form = new FormTrackingSettings();
[[parameters setChangeFieldsValue:[@{@44: @"change_value1"} copy]];
[[MappIntelligence shared] formTracking:parameters];
 
// Set confirm button to false
FormTrackingSettings form = new FormTrackingSettings();
[parameters setConfirmButton:NO];
[[MappIntelligence shared] formTracking:parameters];
 
// Track path analysis
FormTrackingSettings form = new FormTrackingSettings();
[parameters setPathAnalysis:[@[@11, @22, @11, @33] copy]];
[[MappIntelligence shared] formTracking:parameters];
JAVA


Limitations

  • Last Focus does not work and is always set to 0.
  • pathAnalysis needs to be used manually.
  • When using switch, the value of the label cannot be detected. Instead, the value will be displayed the following way:
    • empty if switch is set to off
    • filled_out if switch is set to on


Additional Resources

Please also check out our sample application in our iOS SDK v5 to try out form tracking in a sample app. You can download the SDK in GitHub.