All Products
Search
Document Center

Add custom event log

Last Updated: Jan 18, 2021

Custom event log records button clicks, link clicks and other actions. The logs can be embedded when any action in the App is triggered, and used for custom event analysis and funnel analysis. According to business requirement, you can implement user behavior analysis through custom event tracking.

After integrating MAS to your client, you need to log in to the mPaaS console, and configure the relevant attributes and events on the Mobile Analysis Service > Custom Analysis > Custom configurations page. Then, you can view relevant data on the Custom analysis > Event analysis page.

Tracking

API

The custom event tracking API is defined in the MPRemoteLoggingInterface class of MPMasAdapter. The API is defined as follows:

 
  1. /**
  2. * Behavior tracking API. The client version, user ID, device ID, operating system version, network type, device type, and software version are automatically filled in, and no service tracking is required.
  3. *
  4. * @param bizType: optional, business type, which defaults to User_behavior_iOS. It is recommended that you fill in with the business identification.
  5. * @param eventId: required, event tracking ID.
  6. * @Param extParam: optional, extended parameter, which can be set by service personnel as required. The element is a dictionary, the dictionary content can be customized, and the dictionary will be converted into key-value strings and recorded in logs.
  7. */
  8. + (void)writeLogWithBizType:(NSString *)bizType
  9. eventId:(NSString *)eventId
  10. extParam:(NSDictionary *)extParam;

Parameters

  • bizType: Optional, business type, which defaults to User_behavior_iOS. It is recommended that you fill in with the business identifier.
  • eventId: Tracking ID, corresponding to Event ID on the event creation page in the console.
  • extParam: Extension parameter. The key in the dictionary corresponds to Attribute ID on the attribute creation page in the console, and the value type determines Data type of the attribute.

Code sample

 
  1. [MPRemoteLoggingInterface writeLogWithBizType:@"customBiz" eventId:@"customEvent" extParam:@{@"key":@"v"}];