Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GATracker : MonoBehaviour {
- public GoogleAnalyticsV3 googleAnalytics;
- void Start(){
- googleAnalytics.StartSession ();
- GAGameMuted ();
- }
- void OnApplicationQuit(){
- googleAnalytics.StopSession ();
- }
- // JUEGO DE LA GOTA -------------------------------------------
- //ficha con la que se juega
- public void GASendToken(EmojiEnum _token){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("JuegoDeLaGota")
- .SetEventAction("Final de la partida")
- .SetEventLabel("Ficha Jugada : " + _token)
- .SetEventValue(1));
- }
- //partidas finalizadas
- public void GAGameEnd(){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("JuegoDeLaGota")
- .SetEventAction("Final de la partida")
- .SetEventLabel("Partida Finalizada")
- .SetEventValue(1));
- }
- //juego muteado
- public void GAGameMuted(){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("JuegoDeLaGota")
- .SetEventAction("Opciones")
- .SetEventLabel("Sonido desactivado")
- .SetEventValue(1));
- }
- //Salir en mitad de la partida
- public void GASaveGame(){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("JuegoDeLaGota")
- .SetEventAction("Opciones")
- .SetEventLabel("Juego abandonado")
- .SetEventValue(1));
- }
- //COMEGOTAS -----------------------------------------------------
- //Nivel de dificultad Seleccionado
- public void GADificultySelected(string dificultad){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("Comegotas")
- .SetEventAction("Menu")
- .SetEventLabel("Dificultad " + dificultad + " seleccionada")
- .SetEventValue(1));
- }
- //mundo seleccionado
- public void GASendDificultySelected(string mundo){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("Comegotas")
- .SetEventAction("Menu")
- .SetEventLabel("Mundo de " + mundo + " seleccionado")
- .SetEventValue(1));
- }
- //puntuacion obtenida
- public void GASendScoreInfo(int score){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("Comegotas")
- .SetEventAction("Final de partida")
- .SetEventLabel("Puntuacion conseguida")
- .SetEventValue(score));
- }
- //nivel conseguido
- public void GASendScore(int level){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("Comegotas")
- .SetEventAction("Final de partida")
- .SetEventLabel("Nivel alcanzado")
- .SetEventValue(level));
- }
- //Salir de la partida ( en curso)
- public void GALeaveGame(){
- googleAnalytics.LogEvent(new EventHitBuilder()
- .SetEventCategory("Comegotas")
- .SetEventAction("Opciones")
- .SetEventLabel("Juego abandonado")
- .SetEventValue(1));
- }
- //GENERAL---------------------------------------------------------------
- //pantalla seleccionada
- public void GAScreenSelected( string _screenName){
- googleAnalytics.LogScreen(new AppViewHitBuilder()
- .SetScreenName(_screenName));
- }
- //campañas
- public void GACampaignStarted( string nombre, string contenido ,string medio ,string origen , string id){
- googleAnalytics.LogTiming(new TimingHitBuilder()
- .SetTimingCategory("Loading")
- .SetTimingInterval(50L)
- .SetTimingName("Main Menu")
- .SetTimingLabel("First load")
- .SetCampaignName(nombre)
- .SetCampaignSource(origen)
- .SetCampaignMedium(medio)
- .SetCampaignKeyword("games")
- .SetCampaignContent(contenido)
- .SetCampaignID(id));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement