05/15/2024 15:19:45

Development of the Event Reporting Module

I. Plugin development

The Event Reporting module is a basic extension module of MSDK. Its main function is to assist in reporting the user's operations, behavior events and other information.

[info] Special description about the uninstall tracking function
The uninstall tracking function of the client generally depends on the Push module. The uninstall tracking of App is performed by judging whether the push message is successfully received. If the push message is not received by App, the App can be considered to be uninstalled.
MSDK generally recommends that the game register the token of the Push module in the Event Reporting module after it registers the Push module successfully. The Event Reporting module can use this token for uninstall tracking.
The uninstall tracking function of different platforms:

  • Android needs to rely on the setPushToken method to get the push token. The Event Reporting module generally chooses Firebase as a dependent push plugin. If you want to choose to rely on other push plugins, you can develop corresponding push plugins and use the module in conjunction with them.
  • iOS generally doesn't need to implement this method to set Token. Because iOS has the didRegisterForRemoteNotificationsWithDeviceToken method

[info] The Event Reporting module does not require the method callback

II. Client plugin description

2.1 Android Platform

2.1.1 Class implementation rules

  • Package naming rule: fixed as com.tencent.gcloud.msdk.report
  • Class naming rule: channel + report, such as: AppsFlyerReport
  • Must implement the ReportInterface interface
    • Must implement the init function, used to initialize the plugin
    • Must implement the reportEvent function, used for reporting events
    • Must implement the setPushToken function, used to pass the Token of the Push module to the event reporting plugin for the uninstall tracking of App

2.1.2 ReportInterface interface

  • init function

    The initialization function is used to initialize the Event Reporting module

      @Override
      public void init() {
          // The channel's initialization logic
          ...
      }
    
  • reportEvent function

    The event reporting function is used to report events

      @Override
      public void reportEvent(String seqID, String eventName, HashMap<String, String> params, boolean isRealTime, String extraJson) {
      // The channel's event reporting logic
      ...
      }
    
  • setPushToken function

    Set the push token, which is used to pass the token of the Push module to the event reporting plugin for the uninstall tracking of App.

    1. If the plugin supports uninstall tracking, you can set the Push module's Token in this method

    2. If the Event Reporting module does not support the uninstall tracking function, you can leave this method blank

      @Override
      public void setPushToken(String seqID, String token) {
       // The channel's logic for setting push token
       ...
      }
      

[info] For details, please refer to Demo Code

2.2 iOS Platform

2.2.1 Class implementation rules

  • Naming rules: Fixed as MSDKReport + channel, such as: MSDKReportAppsFlyer
  • Must implement the MSDKReportDelegate protocol
    • The initStat function, which is used to initialize the plugin
    • The reportEvent function, which is used to report events
    • [Optional implementation] The setPushToken function, which is used to pass the token of the Push module to the event reporting plugin for the uninstall tracking of App

2.2.2 MSDKReportDelegate protocol

  • initStat function

    The initialization function is used to initialize the Event Reporting module

      - (bool)initStat {
          // The channel's initialization logic
          ...
      }
    
  • reportEvent function

    The event reporting function is used to report events

      - (void)reportEvent:(NSString *)event params:(NSDictionary *)params isRealtime:(BOOL)realtime seqID:(NSString *)seqID extra:(NSString *) extraJson {
          // The channel's event reporting logic
          ...
      }
    
  • Description of setPushToken function

    Set the push token, which is used to pass the token of the Push module to the event reporting plugin for the uninstall tracking of App.

    iOS generally doesn't need to implement this method to set Token. Because iOS has the didRegisterForRemoteNotificationsWithDeviceToken method

      - (void)setPushToken:(NSString *)pushToken {
          // The channel's logic for setting push token
          ...
      }
    

[info] For details, please refer to Demo Code



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""