Setting up events for Mobile Analytics in iOS

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
Swift
Objective-C
  1. // event without properties
  2. [[PageSense sharedInstance] recordEvent:@"Product viewed"];
Swift
  1. // event without properties
  2. 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:
  1. let eventPropertiesDictionary = ["Product":"productname","Price":"59.99"]
  2. PageSense.trackEvent(eventName: "Product viewed", withProperties: eventPropertiesDictionary)// event without properties
  3. PageSense.trackEvent(eventName: "Product viewed"

Objective-C

  1. // event with properties
  2. NSDictionary *props = @{
  3.     @"Product name": @"Casio Chronograph Watch",
  4.     @"Category": @"Mens Accessories",
  5.     @"Price": @59.99,
  6.     @"Date": [NSDate date]
  7. };
  8.  
  9. [[PageSense sharedInstance] recordEvent:@"Product viewed" withProps:props];
Info
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!