What is the best way to track session length?

I used to use game analytics to track session length but as of October they stopped tracking it. I’m wondering if anyone can think of a good way to do it? The issue I see is sending an event on app close may not be sent but if you don’t send it on app close then you’re not really tracking the session length. 

There’s an event listener for that®: https://coronalabs.com/blog/2012/05/15/handling-corona-system-events/

  • Caleb

Sorry I wasn’t more clear. I know about the system event I’m just not sure how fast I could fire off an event to gameanalytics. I’m thinking the app would close mid call and some users wouldn’t be tracked.

And I even came up with that witty way of presenting the info :D… Have you considered saving the data to a file, then next time the user opens it sending off the data? You’d only get the previous data when the user opens the app, but it’d be better than nothing.

  • Caleb

Haha I guess I did post this in the newbie section so I should have expected that. 

That was what I was thinking about doing maybe. I also thought about trying to send a quick event off on close with a really short timeout and if the event gets fired cool if it fails due to timeout save the session length to a file and then submit it on app open. If the user never comes back though that session length is gone.

I believe that Flurry still sends session length, if you don’t mind adding another analytics provider.  

Alternatively you could save the session time locally and then send it the next time the app opens, although you then won’t get the session time if the user stops using your app and doesn’t open it again.

There’s an event listener for that®: https://coronalabs.com/blog/2012/05/15/handling-corona-system-events/

  • Caleb

Sorry I wasn’t more clear. I know about the system event I’m just not sure how fast I could fire off an event to gameanalytics. I’m thinking the app would close mid call and some users wouldn’t be tracked.

And I even came up with that witty way of presenting the info :D… Have you considered saving the data to a file, then next time the user opens it sending off the data? You’d only get the previous data when the user opens the app, but it’d be better than nothing.

  • Caleb

Haha I guess I did post this in the newbie section so I should have expected that. 

That was what I was thinking about doing maybe. I also thought about trying to send a quick event off on close with a really short timeout and if the event gets fired cool if it fails due to timeout save the session length to a file and then submit it on app open. If the user never comes back though that session length is gone.

I believe that Flurry still sends session length, if you don’t mind adding another analytics provider.  

Alternatively you could save the session time locally and then send it the next time the app opens, although you then won’t get the session time if the user stops using your app and doesn’t open it again.