コード例 #1
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    void Awake()
    {
        if (Instance != null)
        {
            DestroyImmediate(gameObject);
            return;
        }
        else
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }

        name = "Google Analytics";



        GenerateClientId();
        cleint = new GoogleAnalyticsClient(_ClientId);


        if (!IsSessionStarted)
        {
            Client.CreateHit(GoogleAnalyticsHitType.SCREENVIEW);
            Client.StartSession();
            Client.SetUserLanguage(Application.systemLanguage.ToString());
            Client.SetScreenResolution(Screen.width, Screen.height);
            Client.Send();

            IsSessionStarted = true;
        }

        SendFirstScreenHit();
        SubmitSystemInfo();



        if (GoogleAnalyticsSettings.Instance.AutoExceptionTracking)
        {
                        #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
            Application.RegisterLogCallback(HandleLog);
                        #else
            Application.logMessageReceived += HandleLog;
                        #endif
        }

        if (GoogleAnalyticsSettings.Instance.AutoCampaignTracking)
        {
            GA_AndroidTools.RequestReffer();
        }



                #if UNITY_EDITOR
        if (GoogleAnalyticsSettings.Instance.UsePlayerSettingsForAppInfo)
        {
            GoogleAnalyticsSettings.Instance.AppName    = PlayerSettings.productName;
            GoogleAnalyticsSettings.Instance.AppVersion = PlayerSettings.bundleVersion;
        }
                #endif
    }
コード例 #2
0
ファイル: GA_AndroidTools.cs プロジェクト: Gr1nS1de/hg-01
 public static void RequestReffer()
 {
     GA_AndroidTools.CallStatic(ReferalIntentReciever, "RequestReferrer");
 }