Masking user config and location data in Live plugin


I’d like to suggest Piwik add an easy way for a super admin to turn off visibility to config and location data.

On my site, I give each new user a community where they can see the analytics that occur only in their community. However, because I don’t want community mods to see private location and browser information, every time Piwik releases an updated version, I have to manually modify the /plugins/Live/Visitor.php file, specifically function cleanVisitorDetails on line 133. This is what my function looks like:

    public static function cleanVisitorDetails($visitorDetails)
        $toUnset = array('config_id');
        if (!Piwik::hasUserSuperUserAccess()) {
            $toUnset[] = 'idvisitor';
            $toUnset[] = 'user_id';
            $toUnset[] = 'location_ip';

			$remove_words = array('config', 'location');

			foreach ($visitorDetails as $key => $remove)
				foreach ($remove_words as $remove)
				{ if (strpos($key, $remove) !== false) { $visitorDetails[$key] = 'UNK'; } }
        foreach ($toUnset as $keyName) {
            if (isset($visitorDetails[$keyName])) {

        return $visitorDetails;

This modified code prevents anyone who doesn’t have hasUserSuperUserAccess from seeing any location or config details. (I allow them to see custom variables I’ve defined, but you could effectively have a switch to turn those off too pretty easily.) I’m not sure where best the switch functionality should go, but wanted to suggest it.