Possible to do personalized analytics?

A little update on that:

On Github, I found some examples on pn.state, and how it includes ‘pn.state.cookies’, which lets you access the current browser cookies.

And if you use i.e. the bokeh auth module, you get to access the currently logged-in user like this:

{'__cfduid': 'da5f2e71beec882f8fdc38319330a61561593875339', 'csrftoken': 'UqBRAZ4jtuG2hcSoIz2hVVLfJOe8wVXQM715x3IzoTNRBXymLz5MEqdoNwNaDSbw', 'sessionid': 'wo5bb5j1wzsrwkhflwqrr361ncqlfsbi', '_xsrf': '2|1bde6561|c8dc9804ebbfad296666ba8028d83764|1595704372', 'user': '"bokeh"'}

You can then just extract that user from within the panel app with

pn.state.cookies['user']

Example:

Also, it looks like the next version of Panel will support OAuth.

Haven’t tried it with Django yet. Ultimately, I’d want to get the currently logged in Django user instead of using bokeh’s auth module.

1 Like