Track User on shiny app

How can I track user activity on my application?
I have provided them authentication to my app and want to track their activity on my app.

What authentication system are you using? provides user authentication on standard purchase plan.
My question actually was do they also provide user activity tracking

Have you seen this article?

Yes I've managed to setup google analytics with user tracking for a shiny app hosted on with authentication following the article @jcblum posted above.

However I found I had to make some changes to the code suggested in the article for it to work. See this thread for more info.

You have to send the pageview after the userId has been set otherwise the pageview won't be associated with the logged in shiny user. The javascript tracking code below is working for me:

// Initial Tracking Code
  i[r]=i[r] || 
  },i[r].l=1*new Date();

ga('create', 'UA-YOUR-GA-TRACKING-NUMBER-HERE', 'auto');

// User Tracking Code
$(document).one('shiny:idle', function() {
  ga('set','userId', Shiny.user);
  ga('send', 'pageview');

Save your GA code in a file called ga.js in the root directory of your shiny app then call it into the app in your UI script with


You also have to set up a specific view in google analytics with User-ID turned on. When that view is setup you should be able to see user metrics in the AUDIENCE -> USER EXPLORER section of your google analytics dashboard.