All Products
Search
Document Center

iOS client development

Last Updated: Jan 22, 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

1. Access Mobile Analysis Service

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

2. Record event logs

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

Code sample

 
  1. #import <MPMasAdapter/MPMasAdapter.h>
  2. // Currently actionId supports only KActionID_Event and you do not need to pay attention to it.
  3. NSString * actionId = KActionID_Event;
  4. // Event ID
  5. NSString * eventId = @"PayResults";
  6. // Add attributes
  7. NSMutableDictionary * extParam = [NSMutableDictionary dictionary];
  8. // Attribute: payment time. Key corresponds to the attribute ID and Value corresponds to the attribute value.
  9. [extParam setObject:@"2017-05-01 12:03:16" forKey:@"pay_time"];
  10. // Attribute: user ID
  11. [extParam setObject:@"the-userId" forKey:@"user_id"];
  12. // Attribute: payment mode
  13. [extParam setObject:@"alipay" forKey:@"payment_method"];
  14. // Print logs
  15. [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.