Hello, I got Google Analytics tracking set up for my app by overwriting the index_string in the dash app but I now what to send a user_id to GA to tracking specific users. Anyone done this successfully?
I have another service that I use, but yes, I have linked up the api to log the user with their requests.
First, you have to have some sort of way for the user to be associated. How are you managing their log in?
Hi @jinnyzor, I’m currently using Basic Auth provided by the dash-auth package (you actually recommended I change to Flask-Login here Disable concurrent logins for Basic Auth).
I then accessed the username using
from Flask import request username = request.authorization['username']
However, when I used this I had two issues. 1) this exposed the username when I checked the page source 2) the username it showed me wasn’t mine but someone else who was logged in. I could solve problem 1 using hashing or aliases but I’m not sure why I was getting issue two. Do you think Flask-Login would be more reliable?
I dont really know how your application is set up, but for me I cannot see other usernames when I am logged in. I only see mine.
This may be due to something like a layout that is defaulting to as user upon first load. You need to make sure you are using functions in a multi-page sense.
^^ this applies to when logging in with different users