(1) First of all, to apply for registration of a developer account on the Friends Alliance website (if not). Link address: http://www.umeng.com then go to your Account Personal Admin Center page, click on the "Add App" button, if you have not yet applied for your app project Appkey ( Note: Friends of the league for each of your apps to assign a unique identifier, And if an item is to be published on a different platform (such as iOS or Android), you will need to apply for separate appkey for this app separately.
(2) Download the latest game analysis statistics SDK from official website
The steps are: Home---"Product---" u-game (Basic version)---"Unity3d---"Analytics SDK View Integration Document---"In the top right corner of the SDK download---" Game statistics analysis---"top right corner SDK download---" Download Umenggameanalytics_v2.3.unitypackage Import to Unity project.
Import Step: Right-click Assets---"Import package---" Custom package
(3) Add code: If you want to learn more about the scripting features of the AU analytics stats, readers can do their own research. For quick use, the reader can attach the UmengManager.cs script directly to the object that has been activated in the scene, such as the first scene.
//
UmengManager.cs
//
Created by Zhucong on 1/1/14.
Copyright umeng.com. All rights reserved.
Version 1.31
Using Unityengine;
Using System.Collections;
Using Umeng;
public class Umengmanager:monobehaviour
{
static string Appkey;
void Awake ()
{
Dontdestroyonload (Transform.gameobject);
}
Use this for initialization
void Start ()
{
#if unity_android
Import app key logo app (Android)
Appkey = "$$$$$$$$$$$$$$$$$$$$$$$";
#elif Unity_iphone
Import App key identity app (iOS)
Appkey = "$$$$$$$$$$$$$$$$$$$$$$$";
#endif
Set Umeng Appkey
Ga. Startwithappkeyandchannelid (Appkey, "App Store");
Set to False when log publishing is turned on while debugging
Ga. Setlogenabled (FALSE);
Trigger Statistics event Start level
Ga. Startlevel ("your level ID
");
}
Update is called once per frame
void Update ()
{
if (Input.getkeydown (Keycode.escape))
{
End Program
Ga. Finishlevel ("your level ID
");
Application.Quit ();
}
}
#if unity_android
void Onapplicationpause (bool ispause)
{
Debug.Log ("Umeng:onapplicationpause" + ispause);
if (ispause) {
Debug.Log ("Umeng:----OnPause");
Ga.onpause ();
}
else{
Debug.Log ("Umeng:----Onresume");
Ga.onresume ();
}
}
void Onapplicationquit ()
{
Debug.Log ("Umeng:onapplicationquit");
Ga.onkillprocess ();
}
#endif
}
(4) Precautions:
① above theyour level ID一般是刚进入应用的第一个场景的名字,确保用户只要下载打开应用就能被统计到;
② when importing a downloaded package in a unity project, a file with the same name in the project will be overwritten, so make sure you don't have the same name, don't be sure to test it first, and I'm covered with the Android manifest file;
③ View statistics Path: Home---Personal center---u-game Basic Edition (view report).
Unity adds friend League stats (Android and iOS supported)