Skip to content

Manual event tracking

Aside from Install, Open, Update, and Purchase (in-app purchase) which are tracked automatically by Hive SDK, you can manually track the necessary events you want. To do this, you need to register the event to the dashboard of each attribution. For example, you can track specific events like the completion of your game tutorial (TutorialComplete) or the completion of a mission objective (MissionClear). You should implement the manual event tracking after finishing setting up the automatic event tracking.

Manual Event Tracking with Adjust

  1. To track custom events manually, register the events on Adjust dashboard, and get the app token and the event tokens. The app token can be obtained on the dashboard main page, and the event tokens on Dashboard > All Settings > Events. Refer to the Adjust dashboard guide to learn how to get the tokens.
  2. Add the app token and the event token of each event on hive_config.xml. For more details, see the example codes below.
  3. To prevent app spoofing, Adjust dashboard offers SDK Signature. To use this feature, you need to check Adjust contract details. To use this feature, get the required keys and add them in hive_config.xml (secretId, info1, info2, info3, info4).

    <providers>
    <!-- (skipped) -->
    <!-- Do not set the id field of the Adjust node. -->
    <!-- The name field of the Adjust node is fixed to "Adjust." -->
    <!-- The name field of the event node is defined by the game studio. But once it is set, it should be the same for the name field of all other marketing attributions for the sendEvent() request.-->
    <Adjust name="Adjust" id="unused" key="APP_TOKEN" secretId="1" info1="5432112345" info2="334123" info3="555333" info4="111333">
            <events>
                    <event name="TutorialComplete" value="TutorialComplete_EVENT_TOKEN"/>
                    <event name="MissionClear" value="MissionClear_EVENT_TOKEN"/>
            </events>
    <!-- (skipped) -->
    </Adjust>
    </providers>
    
  4. Call Analytics API sendEvent() to send the event. Use event name in hive_config.xml when you send an event. The name is used as a request parameter for sendEvent(), and the value you set will be updated on the dashboard of each attribution.

    • Analytics.sendEvent("TutorialComplete");
    • Analytics.sendEvent("MissionClear");

Tracking Events Manually with Airbridge

  1. Get the required token. For more information on how to get a token, refer to the Airbridge Dashboard Guide.
    • Get the App SDK Token and App Name from Dashboard > Settings > Token Management.
  2. Add the token, app name, and event settings to hive_config.xml according to the instructions below. Refer to the example code below.
  3. Airbridge provides SDK Signature to prevent app spoofing. You must check the agreement with Airbridge to use the related function. To use the related function, get a key and add it to secretId and secret in hive_config.xml. For more information about SDK signature security information, please refer to the Airbridge Guide.
  4. Send events by calling the Analytics API sendEvent(). When sending events, use the `event name` added to hive_config.xml. `name` is used as a parameter when calling the API, and `value` can be checked in the dashboard of each attribution.
    • Analytics.sendEvent("TutorialComplete");
    • Analytics.sendEvent("MissionClear");

Manual Event Tracking with Singular, Appsflyer, Firebase Analytics

  1. Get the required keys from each attribution dashboard. Refer to the guide from each attribution dashboard to learn how to get the keys.
  2. Configure hive_config.xml following the guide below. For more details, see the example codes below. If you use AppsFlyer attribution with Hive SDK iOS (Native, Unity, Unreal), you need to set itunseConnectAppId for Apple AppID.

    <providers>
            <!-- Configure for Singular -->
            <!-- The name field of the Singular node is fixed to "Singular." -->
            <!-- The name field of the event node is defined by the game studio. But once it is set, it should be the same for the name field of all other marketing attributions for the sendEvent() request.-->
            <!-- The value field of the event node is defined by the game studio. -->
            <Singular name="Singular" id="SDK_KEY" key="SDK_SECRET_KEY">
                    <events>
                            <event name="TutorialComplete" value="Tutorial Complete"/>
                            <event name="MissionClear" value="Mission Clear"/>
                    </events>
            </Singular>
    
            <!-- Configure for AppsFlyer -->
            <!-- The name field of the AppsFlyer node is fixed to "AppsFlyer." -->
            <!-- Do not set the id field of the AppsFlyer node. -->
            <!-- The name field of the event node is defined by the game studio. But once it is set, it should be the same for the name field of all other marketing attributions for the sendEvent() request.-->
            <!-- The value field of the event node is defined by the game studio. -->
            <AppsFlyer name="AppsFlyer" id="unused" key="DEV_KEY" itunseConnectAppId="909923112">
                    <events>
                            <event name="TutorialComplete" value="Tutorial Complete"/>
                            <event name="MissionClear" value="Mission Clear"/>
                    </events>
            </AppsFlyer>
    
            <!-- Configure for Firebase Analytics -->
            <!-- The name field of the event node is defined by the game studio. But once it is set, it should be the same for the name field of all other marketing attributions for the sendEvent() request.-->
            <!-- The value field of the event node is defined by the game studio. -->
            <firebase>
                    <events>
                        <event name="TutorialComplete" value="TutorialComplete"/>
                        <event name="MissionClear" value="MissionClear"/>
                    </events>
            </firebase>
    </providers>   
    
  3. Call Analytics API sendEvent() to send the event. Use event name in hive_config.xml when you send an event. The name is used as a request parameter for sendEvent(), and the value you set will be updated on the dashboard of each attribution.

    • Analytics.sendEvent("TutorialComplete");
    • Analytics.sendEvent("MissionClear");

Send an Event via sendEvent()

It is recommended to send tracking event to the attribution only when user activities meet the specific conditions, such as tutorial completion. Call sendEvent() method in the Analytics class to send the tracking event. As the first parameter of sendEvent(), input the value of name property from <event> element, which is defined in hive_config.xml file.

Followings are sample codes sending TutorialComplete event to a marketing attribution to inform that a user has completed a tutorial.

API Reference: hive.Analytics.sendEvent

using hive;    
    String eventName = "TutorialComplete";    
Analytics.sendEvent(eventName);
#include "HiveAnalytics.h"

FString EventName = TEXT("TutorialComplete");
FHiveAnalytics::SendEvent(EventName);

API Reference: Analytics::sendEvent

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    string eventName = "TutorialComplete";    
Analytics::sendEvent(eventName);

API Reference: Analytics.sendEvent

import com.hive.Analytics    
    val eventName = "TutorialComplete"    
Analytics.sendEvent(eventName)

API Reference: AnalyticsInterface .sendEvent

import HIVEService    
    let eventName = "TutorialComplete"    
AnalyticsInterface.sendEvent(eventName)

API Reference: HIVEAnalytics:sendEvent

#import <HIVEService/HIVEService-Swift.h>    
    NSString eventName = @"TutorialComplete";    
[HIVEAnalytics sendEvent: eventName];

Applying Google Ads on-device measurement in Firebase environment

To measure on-device conversions provided by Google Ads in a Firebase environment, you need to implement the Firebase Google ODM Solution. This solution requires the email address or phone number that the user has consented to provide. During the implementation of this solution, if Firebase Authentication or a separate authentication environment introduced by the developer is implemented, the Hive SDK does not collect email addresses and only passes any email address obtained in the response after authentication directly to the Firebase API.

Note

This guide is intended for iOS apps only. Android apps do not require a separate process for measuring on-device conversions in the Firebase environment.

Implementation method

Throughout the entire process below, you must make sure that personal information for identification must not leak from the user's device to the outside.

  1. Download the Google Firebase ODM Unity Plugin and add it to your Unity project.
  2. Implement authentication to obtain the IdP email address or phone number after logging in.
  3. Normalize the email address or phone number according to the method defined by Firebase.
  4. Implement the passing of the normalized email address/phone number to Firebase. Alternatively, implement the passing of the hashed value of the normalized email address/phone number to Firebase. Refer to the example code below.
Note

The plugin API can be called sequentially, but subsequent calls are essentially ignored after being called once per user.

Example code

Below is example code when using the Unity plugin.

Example code using hashed values

using hive;
// Sending the hashed & normalized email address
GoogleODM.setHashedEmailAddress(ComputeSha256Hash("abc@abc.com"));
using hive;
// Sending the hashed & normalized phone number information
GoogleODM.setHashedPhoneNumber(ComputeSha256Hash("+821012345678"));

Example code using plain values

using hive;
// Sending the normalized email address
GoogleODM.setEmailAddress("abc@abc.com");
using hive;
// Sending the normalized phone number information
GoogleODM.setPhoneNumber("+821012345678");