Hi,
I just want to be clear.
I have Anayltics set up to run in my game… to update the anaylictics, I am using this script, where relevant functions are called, at the appropriate time. My thinking is that with each call, the proper analytic is adjusted accordingly.
Other than that, I do nothing. So no set up via the web sit portal, behind establishing the project.
Am I right?
Thank you
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;
public class Analytics_Mng : MonoBehaviour {
public static Analytics_Mng ins;
public static float time_atSplash;
public static float time_ofPlay;
// Use this for initialization
void Start () {
if (ins == null) {
ins = this;
DontDestroyOnLoad (gameObject);
time_atSplash = Time.time;
return;
}
else if(ins != null){
Destroy (gameObject);
}
}
public static void game_launched(){
//sent via splash.
Analytics.CustomEvent ("game_launched");
}
public static void gameplay_started(){
//sent via game mng.
Analytics.CustomEvent ("gameplay_started");
}
public static void game_won(){
//sent via game mng.
Analytics.CustomEvent ("game_won");
}
public static void game_lost(){
//sent via game mng.
Analytics.CustomEvent ("game_lost");
}
public static void game_tied(){
//sent via game mng.
Analytics.CustomEvent ("game_tied");
}
public static void rounds_played(){
//sent via ers mng.
Analytics.CustomEvent ("rounds_played");
}
public static void rounds_played_vs_local(){
//sent via game mng.
Analytics.CustomEvent ("rounds_played_vs_local");
}
public static void rounds_played_vs_cpu(){
//sent via game mng.
Analytics.CustomEvent ("rounds_played_vs_cpu");
}
void OnApplicationPause(bool paused)
{
time_ofPlay = Time.time - time_atSplash;
print (" time of play = " + time_ofPlay.ToString());
Analytics.CustomEvent("time_ofPlay", new Dictionary<string, object>{
{"value", time_ofPlay}
});
}
}