Check out example codes for "unity how to get data of play session time in a text file?". It will help you in understanding the concepts better.

Code Example 1

string path = Application.dataPath + "/Data/DataLog.txt";

        if (!File.Exists(path))
        {
            File.WriteAllText(path, "Level Test1 \n\n");
        }

        string date = "Login Date: " + System.DateTime.Now + "\n";
        string timed = "Session Time: " + System.Timers.Timer;

        File.AppendAllText(path, date);

Learn ReactJs, React Native from akashmittal.com