We have profile pages for members of our website. I want to show our members who has visited their profile page. I currently implement this by recording traffic in our database. Some of the visitors aren't logged in and some are. When the profile page visitor is logged in, I can show the profile page owner a link to the person who visited their profile page.
I want to simply retrieve this information from Google Analytics instead. It's bound to be significantly more accurate (real people, not bots, uniques are far better handled, etc) and it'll be much easier to then implement more detailed statistics.
So is this possible with the GA API? To get a list of visitors for a particular webpage in a date range where some visitors will be logged in during their visit and I can get their username? I guess I would have to pass the visitor's username to GA upon login (I already do that by sending a login event with the username to GA) or at each webpage visit (don't know how to yet).
If this is not so easy with GA, I'm happy to use another analytics tool or service.
It's still a bit fuzzy on what is and what is not considered "Personally Identifiable Information". We've had some people reach out to Google directly, and even then we receive mixed answers.
That being said, this is fairly easy to do by saving a visitor-level custom variable containing the UserID of the person that has logged in. This will tie all of their actions to that particular userID, including the pages they visit. If you query the google API for the value of that custom variable for visitors who hit that page, you'll get what you're looking for.