recording the browser type?

recording the browser type?

by tim st.clair -
Number of replies: 2
Picture of Plugin developers

Is there an easy way to track or store the browser user-agent? Some of my users are starting on a desktop then switching over to ipads and sometimes running into problems. I'd like to be able to identify users by their browser type without having to match sessions and pages back to the server logs.

Average of ratings: -
In reply to tim st.clair

Re: recording the browser type?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
You may want to check the core_useragent class and its methods.
In reply to David Mudrák

Re: recording the browser type?

by tim st.clair -
Picture of Plugin developers

Er, no? This class can tell me about the useragent, but it does nothing to record it anywhere. It doesn't look like moodle ever records information the users other than their IP.

Looks like I'll have to modify datalib's user_accesstime_log and do something like add a column to either {user} or {user_lastaccess}, and do something like:

$DB->set_field('user_lastaccess', 'useragent', $_SERVER['HTTP_USER_AGENT'], array('userid'=>$USER->id, 'courseid'=>$courseid));

seems odd that there's no detail stored on a users browsing experience. I guess people just rely on analytics and not be concerned that it's not tied to an individual session.