Form Tracking

Prev Next

Form tracking captures user interactions with forms in your iOS app — which fields the user touched, in what order, and whether the form was submitted or abandoned. The SDK exposes form tracking via MIFormParameters, with optional MIFormField details, passed to formTracking(_:).

Method

Method

Description

formTracking(_ formParams: MIFormParameters)

Records a form interaction (focus / submit / cancel) using the configured MIFormParameters.

MIFormParameters

Property

Description

formName

Name of the form, used in reporting.

fieldIds

Array of field IDs (NSNumber) that should be reported.

renameFields

Dictionary mapping field IDs to display names.

changeFieldsValue

Dictionary mapping field IDs to alternative reported values.

anonymousSpecificFields

Field IDs whose values should be anonymised when sent.

fullContentSpecificFields

Field IDs whose full content may be sent (overrides global anonymisation).

confirmButton

BOOL: true when the user submitted via the confirm button, false when they abandoned or cancelled.

anonymous

NSNumber (boolean): if true, all field values are reported anonymously.

pathAnalysis

Field IDs to include in path analysis (focus order).

MIFormField

Use MIFormField to describe individual fields when you need to report their content explicitly:

MIFormField(name: "email", andContent: "user@example.com", andID: 1, andWithAnonymus: false, andFocus: true)

Example: track a form submission

let formParams = MIFormParameters(dictionary: [:])
formParams.formName = "Signup"
formParams.fieldIds = [1, 2, 3]
formParams.renameFields = [
    1: "email",
    2: "firstName",
    3: "lastName"
]
formParams.confirmButton = true
formParams.anonymous = false

MappIntelligence.shared()?.formTracking(formParams)
MIFormParameters *formParams = [[MIFormParameters alloc] initWithDictionary:@{}];
formParams.formName = @"Signup";
formParams.fieldIds = [@[@1, @2, @3] mutableCopy];
formParams.renameFields = [@{
    @1: @"email",
    @2: @"firstName",
    @3: @"lastName"
} mutableCopy];
formParams.confirmButton = YES;
formParams.anonymous = @NO;

[[MappIntelligence shared] formTracking:formParams];

Submit vs cancel

  • Set confirmButton = true when the user successfully submitted the form.

  • Set confirmButton = false when the user abandoned or cancelled.

To anonymise sensitive fields (passwords, payment data), list their IDs in anonymousSpecificFields or set anonymous = true for the whole form.

Related: Object Oriented Tracking, Anonymous Tracking, Pages.