- 2 Minutes to read
- Print
- DarkLight
Events
- 2 Minutes to read
- Print
- DarkLight
It is possible to track events with name and additional information in Mapp Intelligence.
Parameter Constants
The following parameters are mandatory and can be configured in the MIActionEvent() object:
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
name | The name of the event as it will be displayed in your analyses | - | Navigation > Events |
The following parameters are optional and can be configured in the MIEventParameters() object:
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
parameters | Adds additional parameters to an event for further description. | Categories > Custom Parameters > Event Parameter | Datatype Text: Navigation > Event Parameter > [Name of parameter] Datatype Figure: metric |
Methods for Events
Method | Description |
---|---|
trackAction() | Sends an action request (for example a click event) to Intelligence. It is mandatory to send an event name in the request. Optionally, you can add additional information such as event or session parameters or user categories. |
Example iOS
Please note that custom parameters are optional in the request.
Define all event information you want to track:
let eventParameters = MIEventParameters(parameters: [20:"ck20Param1"]) let userCategories = MIUserCategories() userCategories.customCategories = [20:"userParam1"] userCategories.birthday = MIBirthday(day: 12, month: 1, year: 1993) let sessionParameters = MISessionParameters(parameters: [10: "sessionParam1"]) let event = MIActionEvent(name: "TestAction") event.eventParameters = eventParameters event.userCategories = userCategories event.sessionParameters = sessionParameters
Call the trackAction method
MappIntelligence.shared()?.trackAction(event)
Full Code Example:
@IBAction func trackCustomAction(_ sender: Any) {
let eventParameters = MIEventParameters(parameters: [20:"eventParam20"])
//user properties
let userCategories = MIUserCategories()
userCategories.customCategories = [20:"userParam20"]
userCategories.birthday = MIBirthday(day: 12, month: 1, year: 1993)
userCategories.city = "Paris"
userCategories.country = "France"
userCategories.customerId = "CustomerID"
userCategories.gender = .female
//sessionproperties
let sessionParameters = MISessionParameters(parameters: [10: "sessionParam1"])
let event = MIActionEvent(name: "TestAction")
event.eventParameters = eventParameters
event.userCategories = userCategories
event.sessionParameters = sessionParameters
MappIntelligence.shared()?.trackAction(event)
}
Define all event information you want to track:
MIEventParameters* eventParameters = [[MIEventParameters alloc] initWithParameters:[@{@20: @[@"ck20Param1"]} copy]]; MIUserCategories* userCategories = [[MIUserCategories alloc] init]; [userCategories setCustomCategories: [@{@20: @"userParam1"} copy]]; [userCategories setCity:@"Paris"]; [userCategories setCountry:@"France"]; [userCategories setCustomerId:@"CustomerID"]; [userCategories setGender: female]; MISessionParameters* sessionParameters = [[MISessionParameters alloc] initWithParameters:[@{@10: @"sessionParam1"} copy]]; MIActionEvent* event = [[MIActionEvent alloc] initWithName:@"TestAction"]; [event setEventParameters:eventParameters]; [event setUserCategories:userCategories]; [event setSessionParameters:sessionParameters];
Call the trackAction method
[[MappIntelligence shared] trackAction:event];
Full Code Example:
-(void) testAction {
MIEventParameters* eventParameters = [[MIEventParameters alloc] initWithParameters:[@{@20: @[@"ck20Param1"]} copy]];
MIUserCategories* userCategories = [[MIUserCategories alloc] init];
[userCategories setCustomCategories: [@{@20: @"userParam1"} copy]];
[userCategories setCity:@"Paris"];
[userCategories setCountry:@"France"];
[userCategories setCustomerId:@"CustomerID"];
[userCategories setGender: female];
MISessionParameters* sessionParameters = [[MISessionParameters alloc] initWithParameters:[@{@10: @"sessionParam1"} copy]];
MIActionEvent* event = [[MIActionEvent alloc] initWithName:@"TestAction"];
[event setEventParameters:eventParameters];
[event setUserCategories:userCategories];
[event setSessionParameters:sessionParameters];
[[MappIntelligence shared] trackAction:event];
}