How do I add a custom user agent so it doesn't show as "unknown"?


#1

Hi, I’m trying to get a custom user agent recognized so it doesn’t show as “unknown” in reports. I’ve added the following to piwik/vendor/piwik/device-detector/regexes/client/mobile_apps.yml (my custom UA is basically an application, so this seemed like the most appropriate file):


- regex: 'MY_CUSTOM_UA(?:/?(\d+[\.\d]+))?'
  name: 'MY_CUSTOM_UA'
  version: '$1'

When I go to to “Device detection” under “Administration”, and paste in the UA string “MY_CUSTOM_UA/1.0” and then click “Refresh”, the detection seems to work. But it doesn’t work for reports, the user agent still is shown as “unknown” (in the “Visitor Browsers” widget, as well as under “Browsers” on the “Vistors” page). Am I missing something?


#2

I found a solution: I added the entry to browsers.yml instead and also had to edit Parser/Client/Browser.php, and then purge the database and re-import all logs. The UA is now being recognized.