All Products
Document Center

iOS client development

Last Updated: Dec 20, 2021

This topic describes how to develop custom event anlaysis funciton on the iOS client, including:

  1. Access Mobile Analysis Service

  2. Record event logs

Access Mobile Analysis Service

Access Mobile Analysis Service by referring to Instructions on access procedure.

Record event logs

The section guides you how to record event logs through a code sample of 10.1.68 version, and gives introduction about the parameters involved in the code sample.

Code sample

#import <MPMasAdapter/MPMasAdapter.h>

// Currently actionId supports only KActionID_Event and you do not need to pay attention to it.
NSString * actionId = KActionID_Event;
// Event ID
NSString * eventId = @"PayResults";
// Add attributes
NSMutableDictionary * extParam = [NSMutableDictionary dictionary];
// Attribute: payment time. Key corresponds to the attribute ID and Value corresponds to the attribute value.
[extParam setObject:@"2017-05-01 12:03:16" forKey:@"pay_time"];
// Attribute: user ID
[extParam setObject:@"the-userId" forKey:@"user_id"];
// Attribute: payment mode
[extParam setObject:@"alipay" forKey:@"payment_method"];

// Print logs
[MPRemoteLoggingInterface writeLogWithActionId:actionId eventId:eventId extParam:extParam];

Instructions on parameters

  • eventId (event ID) An event ID uniquely identifies an event. For more information, see the description of tutorial scenario in About this tutorial.

  • extParam (event attribute)

    ExtParam of the NSDictionary type is used to store attributes associated with events.

    • Key: corresponding to the attribute ID. For more information, see the description of tutorial scenario in About this tutorial.

    • Value: corresponding to the attribute value. The attribute value is stored as a character string on the client. In actual analysis, the server supports converting the attribute value into a character, integer, or float value.