Skip to content

HumanteQ/HQMonitorExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HQMonitor Unity Sample App.

Unity package: hqm_2.3.2.unitypackage

Integration instructions:

  1. Install latest Unity.

  2. Install Play Services Resolver

  3. Download and import hqm_2.3.2.unitypackage

    (Assets -> Import package -> Custom package -> hqm_2.3.2.unitypackage )

  4. Force resolve dependencies:

    (Assets -> Play Services Resolver -> Android Resolver -> Force Resolve)

  5. You can skip this step if your Target API Level < 30.

    • Enable option Custom Main Manifest in Build Settings -> Project Settings -> Player -> Publishing Settings -> Build
    • Place QUERY_ALL_PACKAGES permission in your Assets/Plugins/Android/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package.id">

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

    <application>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
            android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

In order to comply with Google Play policy you also have to declare this permission using the Declaration Form in Play Console. More info

  1. Initialize SDK (ONLY after obtaining user consent):
            ...
            
            // Init SDK
            HQSdk.Init(
                "your_api_key",     // your api key
                true);              // is debug enabled
  1. Send user-defined event:
 
            // Send event as text ...
            HQSdk.LogEvent("test_event", "test");
  1. Send complex user-defined event:
            
            // ... or as a map.
            Dictionary<string, string> map = new Dictionary<string, string>();
            map["test1"] = "test_value1";
            map["test2"] = "test_value2";

            HQSdk.LogEvent("test_event", map);
  1. Request predicted user groups: (HQSdk will need some time, typically 10 - 15 min, to compute user groups)
            // Request predicted user group id list ...
            var groupIdList = HQSdk.GetGroupIdList();
            
            // ... or user group name list
            var getGroupNameList = HQSdk.GetGroupNameList();
            
            ...
  1. Send target segments to Firebase Analytics. Firebase Analytics dependency must be imported separately.
            HQSdk.TrackSegments(true);
  1. Send predefined event InAppPurchase(int revenue, string currency, string item_name).

    currency - a string representing a currency id in ISO 4217 format (https://www.currency-iso.org/dam/downloads/lists/list_one.xml)

            HQSdk.InAppPurchase(75, "EUR", "Useful item name");
  1. Send predefined event SubscriptionPurchase(int revenue, string currency, string item_name, string status).

    currency - a string representing a currency id in ISO 4217 format (https://www.currency-iso.org/dam/downloads/lists/list_one.xml)

    status - state of purchase event (trial/first/renewal/...)

            HQSdk.InAppPurchase(75, "EUR", "Useful item name", "trial");
  1. Send predefined event TutorialStep(string step, string result).

    step - a current step of tutorial

    result - a result of the current step

            HQSdk.TutorialStep("onboarding_step_1", "start");

Startup script example: HqmUnity.cs

GDPR compliance.

To comply with GDPR, we provide following user data management methods:

  1. Request for user data. A report with current user data will be sent to the provided email.
            HQSdk.RequestUserData("some@email.org");
  1. User data deletion request. All current user data will be deleted from Humanteq servers.
            HQSdk.DeleteUserData();

About

HQ SDK integration sample for unity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •