Setting up events for Mobile Analytics in iOS
A User Event is an action that a user takes in your mobile application. PageSense records the event on the User Profile, using an event name and optional associated key:value based event properties.
An example of recording a Product Viewed user event is shown as follows:
Objective-C
- // event without properties
- [[PageSense sharedInstance] recordEvent:@"Product viewed"];
Swift
- // event without properties
- PageSense.trackEvent(eventName: "Product viewed")
To record a list of items viewed, use the Items collection. Along with the product name, you can also add properties like size, color, category etc. An example of recording a Product Viewed user event with properties is shown as follows:
- let eventPropertiesDictionary = ["Product":"productname","Price":"59.99"]
- PageSense.trackEvent(eventName: "Product viewed", withProperties: eventPropertiesDictionary)// event without properties
- PageSense.trackEvent(eventName: "Product viewed"
Objective-C
- // event with properties
- NSDictionary *props = @{
- @"Product name": @"Casio Chronograph Watch",
- @"Category": @"Mens Accessories",
- @"Price": @59.99,
- @"Date": [NSDate date]
- };
-
- [[PageSense sharedInstance] recordEvent:@"Product viewed" withProps:props];
Data types: The value of a property can be of type NSDate, a NSNumber, a NSString, or a BOOL.
NSDate
object: When a property value is of type NSDate, the date and time are
both recorded to the second. This can be later used for targeting
scenarios. For e.g. if you are recording the time of the flight as an
event property, you can send a message to the user just before their
flight takes off.
Events help you understand how your users interact with your app. PageSense tracks certain common user events automatically while giving you the flexibility to record business-specific events.
We’ve designed this documentation to guide you every step of the way. If
you need further assistance or have any questions, don’t hesitate to
contact us at support@zohopagesense.com - we’re always here to help!