So I would like to log some simple website/web application hits in a web app, log page, time, user name when someone accesses the app.
This older thread here suggested doing:
console.log(IdentityManager.credentials[0].userId)
This works great when used inside one of my widgets, and I might use it there to figure out who actually uses them. But where would be the place to put this to log web app access before any widget's been activated? I haven't delved into the jimu/WAB code beyond life inside widgets. First attempt at putting it in something like main.js have failed and returned Null.
I'm not really wanting to go through Portal, as suggested here, where an app is shared with everyone and not accessed through Portal and necessarily registered there. But maybe registering it there regardless is the solution? Any guidance is appreciated.