var timeStarted = new Date().toLocaleString();
alert(“course was started at: “+timeStarted);
The variable timeStarted you can retain between sessions, make sure its only called once by adding a condition..
You could use default variables for the condition or create a custom one like this:
3. Create a variable -> isPageVisited = 0
Now the JS function gets called only 1 time, and you can always call/reuse the timeStarted variable