コード例 #1
0
    // Use this for initialization
    void Awake()
    {
        Debug.Log("awake");
        Amplitude amplitude = Amplitude.getInstance();

        amplitude.setServerUrl("https://api2.amplitude.com");
        amplitude.logging = true;
        amplitude.trackSessionEvents(true);
        amplitude.useAdvertisingIdForDeviceId();
        amplitude.init("e7177d872ff62c0356c973848c7bffba");
        Debug.Log(amplitude.getDeviceId());

        Dictionary <string, bool> trackingOptions = new Dictionary <string, bool>();

        trackingOptions.Add("disableCity", true);
        trackingOptions.Add("disableIPAddress", true);
        trackingOptions.Add("disableIDFV", true);
        trackingOptions.Add("disableIDFA", true);
        trackingOptions.Add("disableCountry", true);

        Amplitude app2 = Amplitude.getInstance("app2");

        app2.logging = true;
        app2.trackSessionEvents(true);
        app2.setTrackingOptions(trackingOptions);
        app2.setDeviceId("111111bca");
        app2.init("3653adbf32717221cacbf722f4671052");
        Debug.Log(app2.getDeviceId());
        app2.logEvent("logging to unity demo 2");
        app2.logEvent("keep logging events");
    }
コード例 #2
0
ファイル: AmplitudeManager.cs プロジェクト: larnin/Diogene
    void OnGameOver(GameOverEvent e)
    {
        float time       = Time.time - _startTime;
        var   chunkDatas = G.Sys.chunkSpawner.allDatas();

        _sumCoin += e.RunCoin;
        _runCount++;
        _sumRunTime += time;
        if (e.RunScore > _distanceMax)
        {
            _distanceMax = e.RunScore;
        }

        Dictionary <string, object> UserProperties = new Dictionary <string, object>();

        UserProperties.Add("RJump", _jumpCount);
        UserProperties.Add("Rhole", chunkDatas.holesCount);
        UserProperties.Add("RDistanceMax", e.RunScore);
        UserProperties.Add("RChunkDeath", G.Sys.chunkSpawner.currentChunkID());
        UserProperties.Add("RCoins", e.RunCoin);
        UserProperties.Add("RCheat", e.RunCoin / e.RunScore);
        UserProperties.Add("RRing", chunkDatas.ringCount);
        UserProperties.Add("RTRun", time);
        UserProperties.Add("RArms", chunkDatas.armCount);
        UserProperties.Add("RFps", _frames / time);
        _amplitude.logEvent("EndRun", UserProperties);
    }
コード例 #3
0
    void OnGUI()
    {
        // Make a background box
        GUI.Box(new Rect(10, 10, 100, 90), "Loader Menu");

        // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
        if (GUI.Button(new Rect(20, 40, 80, 20), "Level 1"))
        {
            Amplitude amplitude = Amplitude.Instance;
            amplitude.logEvent("tapped");
            Dictionary <string, object> userProperties = new Dictionary <string, object>()
            {
                { "float_gprop", 1.0 }
            };
            amplitude.setUserProperties(userProperties);

            Dictionary <string, object> demoOptions = new Dictionary <string, object>()
            {
                { "Bucket", "A" },
                { "Credits", 9001 }
            };
            amplitude.logEvent("unity event 2", demoOptions);
            amplitude.logRevenue(0.03);
            amplitude.logRevenue("sku", 1, 1.99);
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                amplitude.logRevenue("sku", 1, 1.99, "cmVjZWlwdA==", null);
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                amplitude.logRevenue("sku", 1, 1.99, "receipt", "receiptSignature");
            }
        }
    }
コード例 #4
0
    // Use this for initialization
    void Awake()
    {
        Debug.Log("awake");
        // Amplitude amplitude = Amplitude.Instance;
        Amplitude amplitude = Amplitude.getInstance();

        amplitude.logging = true;
        amplitude.trackSessionEvents(true);
        amplitude.init("a2dbce0e18dfe5f8e74493843ff5c053");
        Debug.Log(amplitude.getDeviceId());

        Dictionary <string, bool> trackingOptions = new Dictionary <string, bool>();

        trackingOptions.Add("disableCity", true);
        trackingOptions.Add("disableIPAddress", true);
        trackingOptions.Add("disableIDFV", true);
        trackingOptions.Add("disableIDFA", true);
        trackingOptions.Add("disableCountry", true);

        Amplitude app2 = Amplitude.getInstance("app2");

        app2.logging = true;
        app2.trackSessionEvents(true);
        app2.setTrackingOptions(trackingOptions);
        app2.init("3653adbf32717221cacbf722f4671052");
        Debug.Log(app2.getDeviceId());
        app2.logEvent("logging to unity demo 2");
        app2.logEvent("keep logging events");
    }
コード例 #5
0
    void Start()
    {
        Amplitude amplitude = Amplitude.Instance;

/*		Dictionary<string, object> userProperties = new Dictionary<string, object>()
 *              {
 *                      {"float_gprop", 1.0}
 *              };
 *              amplitude.setUserProperties(userProperties);
 *
 *              Dictionary<string, object> demoOptions = new Dictionary<string, object>()
 *              {
 *                      {"Bucket" , "A" },
 *                      {"Credits" , 9001}
 *              };
 *              amplitude.logEvent("unity event 2", demoOptions);
 *              amplitude.logRevenue(0.03);*/
        amplitude.setOnceUserProperty("bool", true);
        amplitude.setOnceUserProperty("boolArray", new bool[] { true, false, false });
        amplitude.setOnceUserProperty("stringArray", new string[] { "this", "is", "a", "test" });
        amplitude.unsetUserProperty("bool");
        amplitude.setUserProperty("string", "this is a test");
        amplitude.setUserProperty("stringArray", new string[] { "replace", "existing", "strings" });
        amplitude.appendUserProperty("stringArray", new string[] { "append", "more", "strings" });
        amplitude.setUserProperty("floatArray", new float[] { 123.45f, 678.9f });
        amplitude.setUserProperty("doubleArray", new double[] { 123.45, 678.9 });

        Dictionary <string, object> dictValue = new Dictionary <string, object>()
        {
            { "key3", "value3" },
            { "key4", "value4" }
        };

        amplitude.setOnceUserProperty("dictValue", dictValue);

        List <int> intList = new List <int> ();

        intList.Add(4);
        intList.Add(5);
        intList.Add(6);
        amplitude.setOnceUserProperty("intList", intList);

        List <string> stringList = new List <string> ();

        stringList.Add("string2");
        stringList.Add("list2");
        amplitude.setUserProperty("stringList", stringList);

        amplitude.addUserProperty("floatValue", 10.0f);
        amplitude.addUserProperty("intValue", -1);

        amplitude.appendUserProperty("newIntValue", 15);
        amplitude.appendUserProperty("intValue", false);

        amplitude.appendUserProperty("intList", new int[] { 7, 8, 9 });
        amplitude.appendUserProperty("stringList", stringList);

        amplitude.logEvent("this is a test");
        Debug.Log(amplitude.getDeviceId());
    }
コード例 #6
0
 public void SendRunTutorialPassed()
 {
     if (_firebaseInitialized)
     {
         FirebaseAnalytics.LogEvent("run_tutorial_passed");
     }
     Analytics.CustomEvent("run_tutorial_passed");
     _amplitude.logEvent("run_tutorial_passed");
 }
コード例 #7
0
ファイル: Menu.cs プロジェクト: dgeisert/life
    void Start()
    {
        amplitude.logEvent("start");
        instance = this;
        config   = JsonUtility.FromJson <Config>(Resources.Load("config").ToString());

        OpenMainMenu();
    }
コード例 #8
0
ファイル: AmplitudeLogger.cs プロジェクト: sashawik/LG
    public void LogEvent(string EventName, string par1, string par2)
    {
        Amplitude amplitude = Amplitude.Instance;

        amplitude.trackSessionEvents(true);
        amplitude.useAdvertisingIdForDeviceId();
        amplitude.init(ApiKey);
        amplitude.logEvent(EventName);
        amplitude.setUserProperty(par1, par2);
        amplitude.uploadEvents();
        Debug.Log(amplitude.getSessionId());
    }
コード例 #9
0
    void Start()
    {
        Amplitude amplitude = Amplitude.Instance;

        amplitude.logRevenue(0.03);
        amplitude.setOnceUserProperty("bool", true);
        amplitude.setOnceUserProperty("boolArray", new bool[] { true, false, false });
        amplitude.setOnceUserProperty("stringArray", new string[] { "this", "is", "a", "test" });
        amplitude.unsetUserProperty("bool");
        amplitude.setUserProperty("string", "this is a test");
        amplitude.setUserProperty("stringArray", new string[] { "replace", "existing", "strings" });
        amplitude.appendUserProperty("stringArray", new string[] { "append", "more", "strings" });
        amplitude.setUserProperty("floatArray", new float[] { 123.45f, 678.9f });
        amplitude.setUserProperty("doubleArray", new double[] { 123.45, 678.9 });

        Dictionary <string, object> dictValue = new Dictionary <string, object>()
        {
            { "key3", "value3" },
            { "key4", "value4" },
            { "keyFloat", (float)1.23 },
            { "keyDouble", 2.34 }
        };

        amplitude.setOnceUserProperty("dictValue", dictValue);

        List <int> intList = new List <int> ();

        intList.Add(4);
        intList.Add(5);
        intList.Add(6);
        amplitude.setOnceUserProperty("intList", intList);

        List <string> stringList = new List <string> ();

        stringList.Add("string2");
        stringList.Add("list2");
        amplitude.setUserProperty("stringList", stringList);

        amplitude.addUserProperty("floatValue", 10.0f);
        amplitude.addUserProperty("intValue", -1);

        amplitude.appendUserProperty("newIntValue", 15);
        amplitude.appendUserProperty("intValue", false);

        amplitude.appendUserProperty("intList", new int[] { 7, 8, 9 });
        amplitude.appendUserProperty("stringList", stringList);

        amplitude.logEvent("this is a test");
        Debug.Log(amplitude.getDeviceId());
        amplitude.uploadEvents();
    }
コード例 #10
0
 public void LogEvent(string eventToReport)
 {
     UpdateUserProperties();
     amplitude.logEvent(eventToReport);
 }