Add a custom event log

更新时间:
复制 MD 格式

Custom event logs record actions, such as button and link clicks. You can add instrumentation that triggers when an action occurs in your app. These logs are used for features such as custom event analysis and funnel analysis to help you analyze user behavior.

After you integrate the client, you must also configure the relevant properties and events in the console. Go to Custom Analysis > Custom Configuration. You can then view the related data under Custom Analysis > Event Analysis.

Instrumentation

Interface

The custom event instrumentation interface is defined in the MPRemoteLoggingInterface class of MPMasAdapter. The interface is defined as follows:

/**
 *  Behavior instrumentation interface. The client version, user ID, device ID, operating system version, network type, device type, and software version are automatically filled. You do not need to add instrumentation for these parameters.
 *  @param bizType  Optional. The business type. The default value is User_behavior_iOS. Specify a business identifier.
 *  @param eventId  Required. The instrumentation ID.
 *  @param extParam Optional. The extension parameters. Fill them as needed. The elements are dictionaries. The dictionary content is customizable. The dictionary is converted into a key-value string and recorded in the log.
 */
+ (void)writeLogWithBizType:(NSString *)bizType
                    eventId:(NSString *)eventId
                   extParam:(NSDictionary *)extParam;

Parameters

  • bizType: Optional. The business identifier. The default value is User_behavior_iOS.

  • eventId: The instrumentation ID. This corresponds to the Event ID for a new event in the console.

  • extParam: The extension parameters. This is a dictionary where each key corresponds to the Property ID of a new property in the console, and the value type determines the property's Data Type.

Code example

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