Mi nombre es Fernando Briano y soy programador.

UserAgent-Spy WordPress Plugin (English)


UserAgent-Spy is a WordPress plugin which displays the user’s Operative System and Web Browser in the comments. It uses the comment->agent property to access the UserAgent string, and through a series of regular expresions, detects the O.S. and browser. Then it shows a message with an icon of the browser and O.S.

Your feedback is very important, new features have been added by request, so if there’s something you would like to see in UA-Spy, leave a comment, and I’ll see what I can do. If you want to contribute code, images, or whatever you think may be useful to UserAgent-Spy, write a comment below or drop me an e-mail (fernando at picandocodigo.net).

Donate to the development of the plugin:


UserAgent Spy on WordPress 2.6 default theme

UserAgent Spy on WordPress 2.6 default theme


  • Upload useragent-spy folder to /wp-contents/plugins/
  • Login to your WordPress Admin menu, go to Plugins, and activate it.
  • In your WordPress Admin menu, you will find a new menu under Settings called UserAgent Spy. There you can choose the displayed icons size, and select where to display the plugin. There are three options for displaying the plugin:
  1. Before the comment text. User’s WebBrowser and OS will be displayed before comment text.
  2. After the comment text.User’s WebBrowser and OS will be displayed after comment text.
  3. Custom (Advanced). You can specify the location using the useragent_spy_custom() function inside the comments loop in your template (Generally in comments.php).
    <?php foreach ($comments as $comment) : ?>
    <cite><?php comment_author_link() ?></cite> <?php useragent_spy_custom(); ?> says:<br />
    <?php comment_text() ?>
    CAUTION: If you select “Custom” and don’t use <?php useragent_spy_custom(); ?> in your template, you won’t get the information displayed.

Features (Check Release Notes below to see new features being added)

  • Detects most popular web browsers and Operative Systems (It’s a work in progress, many more browsers/o.s. ‘s to come)
  • Shows browser icon, name, and a link to the browser’s homepage (this will be customizable in future versions).
  • Shows browser/os in the comments management page (unless using “custom” option).
  • Customizable, has its own Options Page where you can change the size of the browser/o.s. icon, and where you want it to be displayed.
  • Published under GPLv3

Some of you may compare this to another well-known plugin named browsersniff. UserAgent-Spy is written completelly from scratch, with several improvements over browsersniff:

  • Easy standard installation, just upload to wp-plugins and activate it.
  • Customizable options.
  • No basic knowledge of PHP or editing WordPress templates required
  • Published under GPLv3.


66 comentarios en este post

  1. Avatar fernando 29 de jul, 2008 - 20:46 Debian IceWeasel 3.0.1 Debian GNU/Linux

    You can see the plugin at work right here!

  2. Avatar Pablo 29 de jul, 2008 - 21:01 Firefox 3.0.1 GNU/Linux

    Just trying it on Firefox / Ubuntu Linux

  3. Avatar francisco 30 de jul, 2008 - 04:17 Firefox 3.0 SuSE

    mmmm, nice work

  4. Avatar Chip Bennett 22 de ago, 2008 - 21:14 Firefox Kubuntu

    I’m a Broswer Sniff user; just testing my Kubuntu/Firefox UA with UA-Spy. I think Browser Sniff uses a lot of memory, so I’m always open to something more lightweight!

  5. Avatar fernando 22 de ago, 2008 - 21:17 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Hope you like UA-Spy. I’m really open for feature requests, ideas, and opinions.

    Tell me if you made the switch!


  6. Avatar Chip Bennett 23 de ago, 2008 - 02:15 Firefox Kubuntu

    Hola Fernando!

    One thing I would *really* like to see, is the ability to display *only* the icons (that is, no text, just icons).

    That feature alone would get me to switch in a heartbeat!

    I’ve installed the plugin, but haven’t had time to play around with it yet. I’ll try it out shortly, though.

  7. Avatar Chip Bennett 23 de ago, 2008 - 12:17 Firefox Kubuntu

    Hola Fernando,

    I’m trying out the plugin, but have two issues:

    1) The images are not displaying. I have the icon size set to 16, but the SRC string being printed by the function is 40 – that is, the function returns an image SRC like *siteurl*/plugins/useragent-spy/image/40/net/firefox.png – and of course, the /image/40/ directory doesn’t exist.

    I can’t find anything in the plugin or options files that would be causing this behavior.

    (Side note: reading through the code in the plugin’s PHP file, there is a comment that useragent_spy_custom() is deprecated, and that useragent_spy() should be used instead. Your instructions still indicate to use the former function. Both seem to work identically. Which is correct?)

    2) Can you add an option *not* to display the full UA string in the comment when logged in as administrator? It breaks my comment layout. (Perhaps add it as hover text, instead?)

  8. Avatar Chip Bennett 23 de ago, 2008 - 12:47 Firefox Kubuntu

    Another update – I have it working, but with a couple of ugly-hack fixes:

    1) I have copied the 16px icons into a “40” directory, in order to make the SRC printed by the function to be valid.

    (Please take a look at the source for one of my posts with comments, in order to see what I’m talking about on this one.)

    2) I have commented out the line that prints the UA string if logged in as administrator.

    Another thing (though I notice it is commented as “TO DO”) – saved settings are not displayed on the settings page.

  9. Avatar fernando 23 de ago, 2008 - 18:37 Debian IceWeasel 3.0.1 Debian GNU/Linux

    I’m rolling out 0.5 version of UserAgent-Spy today. It’s a major update, with several fixes, including the option to not display full UA string among others.

    I’ll update this page as soon as it’s up.
    Thanks for your feedback, the ability to display *only* the icons has been implemented!


  10. Avatar fernando 23 de ago, 2008 - 20:43 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Version 0.5 is out, with some major changes 😀

  11. Avatar Chip Bennett 24 de ago, 2008 - 02:17 Firefox Kubuntu

    I just updated to Version 0.5; great stuff!

    I still have the issue, though, of the plugin trying to set the icon IMG SRC as /plugins/useragent-spy/image/40/ directory, when it should be /plugins/useragent-spy/image/16/ (I have the icon size option set to 16.)

    Any clue what might be causing that?

    Otherwise, everything is great! It displays exactly the way I’ve been wanting it to!


  12. Avatar Chip Bennett 24 de ago, 2008 - 13:16 Firefox Kubuntu


    Still trying to figure out why UA Spy seems to think that I’m setting the icon size to “40”.

    Could it be an issue with the global variable $size? Could something else (perhaps another plugin?) be using the same global variable?

    I might try more ugly hacking, and change $size to $uasize, or something, and see if the correct icon size setting gets passed to the function.

  13. Avatar Chip Bennett 24 de ago, 2008 - 13:22 Firefox Kubuntu


    Changing $size to $uasize seems to have worked.

    Now, when I have the setting at “16”, the function correctly links to the 16px icon directory (likewise with the “24” setting).

    (By the way, those 24px icons are gorgeous!)

  14. Avatar fernando 24 de ago, 2008 - 21:30 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Thanks a lot.
    I’ll change the name of the variable for future releases, as it’s pretty generic, and the same problem could happen again. That was my bad. I’ll commit 0.5.1 with that fix, and anyother bug that comes up these days.

    Glad you liked the new stuff. Your idea of displaying icons only was great, I’m using it on my blog as well as you can see.

  15. Avatar giovanealex 2 de sep, 2008 - 19:46 Google Chrome Windows Vista

    Google Chrome, Google’s browser, was just released – it would be nice to see this plugin dectecting it too.

  16. Avatar fernando 2 de sep, 2008 - 19:52 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Check for an update tonight.
    I’ll upload a new version with Chrome detection.


  17. Avatar fernando 3 de sep, 2008 - 00:26 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Done, the plugin now detects Google Chrome.

    Your WordPress should ask you to update the plugin soon, since it was just uploaded.

  18. Avatar albertux7 3 de sep, 2008 - 16:37 Opera 9.52 GNU/Linux

    La version 0.5.1 no contiene imagenes ( el “upgrade automatic” borra la carpeta img/ )

    solo basta copiar la carpeta img de la version anterior


  19. Avatar fernando 3 de sep, 2008 - 20:02 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Gracias albertux, ya está arriba la versión 0.5.2, con ese bug y otro fix arreglados.


  20. Avatar Montblanc 14 de sep, 2008 - 22:41 Debian IceWeasel 3.0.1 GNU/Linux

    Thank you! It works as a charm! 😉

  21. Avatar Montblanc 14 de sep, 2008 - 22:44 Debian IceWeasel 3.0.1 GNU/Linux

    Tried to switch user-agent. Delete this comment if you wish.

  22. Avatar Montblanc 14 de sep, 2008 - 22:45 Debian IceWeasel 3.0.1 Kubuntu

    Trying with Kubuntu.

  23. Avatar kirksydney 16 de sep, 2008 - 11:22 Firefox 3.0b5 Windows XP

    Nice work! So easy to install unlike the other plug in that I saw awhile ago. However, I hope you could make it more specific. Meaning what version of browser (eg: Mozilla Firefox 3.0, Internet Explorer 7.0, etc etc.) And what version of OS (eg: Windows XP, Windows Vista, etc etc.)

    Just like in this plug in: http://priyadi.net/archives/2005/03/29/wordpress-browser-detection-plugin/

    Too bad, the author of that plug in didn’t make easier installation as you did.

    Also, please make the icons transparent. It looks awkward on my black background when using Internet Explorer.

    Thank you so much.

  24. Avatar fernando 16 de sep, 2008 - 18:46 Debian IceWeasel 3.0.1 Debian GNU/Linux

    Version numbers will be included in a future release. As soon as I get the time to implement it.

    The icons ARE transparent, they are transparent PNG. Internet Explorer doesn’t support transparency for PNGs on version 6, which pretty much sucks, so you just shouldn’t use Internet Explorer, for your own good. And for everyone else’s good. Update your browser.


  25. Avatar kirksydney 19 de sep, 2008 - 02:35 Firefox 3.0b5 Windows XP

    I hope that “future release” would be anytime soon. Thank you for replying and for this awesome plug in. Looking forward to that update. More power.

    By the way, why am i getting this on my previous comments:

    Using [Unidentified browser (yet)] Unidentified browser (yet) on [Unknown O.S.] Unknown O.S.

    Example link: http://kirksydney.com/2008/09/ang-epektibong-suob/

    Please take a look at it. 😀

  26. Avatar kirksydney 22 de sep, 2008 - 05:39 Firefox 3.0b5 Windows XP


    What I did instead was I assigned Firefox and Windows as the default browser and OS so I got my problem resolved.

    I hope the version numbers coming out very soon, though. ;D

  27. Avatar kirksydney 16 de nov, 2008 - 13:15 Firefox 1.5 Windows XP

    Just revisiting here to say that I appreciate the little update you did. Although the changes that I can only see is the Internet Explorer version numbers. Hope you could do the same with the rest of the browsers, and with the Operating Systems as well. Thank you so much.

  28. Avatar fernando 16 de nov, 2008 - 15:35 Debian IceWeasel 3.0.3 Debian GNU/Linux

    Great decision to make Firefox your default web browser.

    Other browsers and O.S.’s versions will be included too. I just need some time to dedicate to my other WordPress Plugin which hasn’t been updated for a while.

    Thanks for using UserAgent-Spy.

  29. Avatar kirksydney 18 de nov, 2008 - 15:05 Firefox 1.5 Windows XP

    Great! I’ll look forward to that. 😀

  30. Avatar Chip Bennett 14 de dic, 2008 - 10:03 Firefox Kubuntu


    I’m still loving this plugin; thanks again for your great work.

    I just updated to WP 2.7, but haven’t yet implemented the new commenting features. One of the main reasons is that I’m unsure how to incorporate your plugin into the new wp_list_comments function.

    Any thoughts/ideas? Do you have UA-spy working with wp_list_comments in WP 2.7?

  31. Avatar fernando 14 de dic, 2008 - 13:30 GNU IceCat 3.0.3 Debian GNU/Linux

    I haven’t yet updated the plugin to be compatible with the new version of comments. Apparently there’s some new work to do to support the new threaded comments.

    That’s one of the reasons why I haven’t yet updated my blog to WP 2.7.

    But I’ll get to it any time soon.


  32. Avatar dani 22 de dic, 2008 - 11:05 Firefox 3.0.5 Gentoo

    nice plugin fernando, better if it support x/html & accessibility too :)

  33. Avatar fernando 5 de ene, 2009 - 01:13 GNU IceCat 3.0.3 Debian GNU/Linux

    I’ve already fixed support for xhtml on version 0.6, I think it’s working fine now. What do you mean by accesibility?


  34. Avatar Igneous 2 de feb, 2009 - 11:32 Debian IceWeasel 3.0.5 Debian GNU/Linux

    Hello Fernando, I really like this plugin, and I really appreciate that you took the time to write it, but unfortunately it does not work with WP 2.7, so I am unable to use it. Are you planning on trying to fix it, or is this now a dead project?

  35. Avatar fernando 2 de feb, 2009 - 21:33 GNU IceCat 3.0.5 Debian GNU/Linux

    This project is far from abandoned. I just haven’t had the time to make it work with WordPress 2.7. It’s really demotivating, since a lot was changed in 2.7, but I’ll get to it soon.

    Glad you like the plugin, I’ll try to get it to work with new WordPress.


  36. Avatar Igneous 3 de feb, 2009 - 00:03 Debian IceWeasel 3.0.5 Debian GNU/Linux

    Fernando: Thank you! I would be greatly endebted to you if you were to get it working with WP 2.7. Also, if you ever need a beta tester before you take it public, be sure to send me an email, I’d be more than happy to help :)

  37. Avatar V-Teq 12 de feb, 2009 - 13:47 Firefox 3.0.6 GNU/Linux

    Really nice plugin! I like it very much, thanks!
    But I’m also curious about support for CentOS recognition, I found it not working on my site (using a CentOS from my university).

  38. Avatar V-Teq 12 de feb, 2009 - 13:50 Firefox 3.0.6 GNU/Linux

    Back to previous comment:
    The user-agent string for CentOS (that was not recognized) was like:
    Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko) CentOS/3.5.4-13.el5.centos

  39. Avatar fernando 19 de feb, 2009 - 19:47 GNU IceCat 3.0.5 Debian GNU/Linux

    New version is out: 1.0rc1. That’s release candidate 1. If everything works fine, version 1.0 final won’t be too far away.

    CentOS detection included.

    Still needing to port it to WP 2.7 thought, that’s the next milestone on my book…


  40. Avatar fernando 3 de mar, 2009 - 22:44 GNU IceCat 3.0.5 Debian GNU/Linux

    Version 1.0rc2 is out. Working perfectly on WordPress 2.7.1 (this blog)…

  41. Avatar V-Teq 21 de mar, 2009 - 17:23 BonEcho GNU/Linux

    Nice work, Fernando! :-)

    ..now testing from Bon Echo.

  42. Avatar fernando 24 de mar, 2009 - 23:32 GNU IceCat 3.0.7 Debian GNU/Linux

    Thanks V-Teq, BonEcho being detected and shown with its logo…
    By the way, you should update your browser!


  43. Avatar dani 7 de may, 2009 - 13:10 Firefox 3.0.10 Gentoo

    it sounds ugly if screen reader/voice browser users must hear the inline UA string too.

  44. Avatar V-Teq 8 de jun, 2009 - 21:24 Google Chrome GNU/Linux 64 bits

    Just testing Google Chrome 3 (unstable) for Linux.

  45. Avatar sandrar 10 de sep, 2009 - 12:39 Internet Explorer 6.0 Windows XP

    Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

  46. Avatar Rajiva 13 de dic, 2009 - 07:49 Konqueror 3.5 SuSE

    Thank’s for share. I must learn how that plugins work..

  47. Avatar Hugh 4 de ene, 2010 - 21:48 Camino 2.0.1 Mac OS

    I love your plugin. I have been using k2 and wp since 2005. When I updated to k2-rc8 a few months ago your plugin hides all the comments and does not show the browser feedback.

    I would like to continue using your plugin if possible.
    Using WP 2.9

  48. Avatar mua sam vui 25 de jun, 2011 - 02:34 Unknown Unknown O.S.

    i am just make sure …

  49. Avatar jam 25 de jun, 2011 - 02:35 Fennec 4.0 Android

    and this is the good plugin ! but not full jet !

  50. Avatar Hatiyah 23 de nov, 2011 - 22:19 Google Chrome 15.0.874.120 GNU/Linux

    useragent-spy nice for detect browser and os

  51. Avatar ppsalama 28 de dic, 2011 - 18:23 Google Chrome 15.0.900.2 GNU/Linux


  52. Avatar ppsalama 28 de dic, 2011 - 18:33 Safari 535.2 GNU/Linux

    está muy bien… lo instalaré en mi blog

  53. Avatar pepehillo 28 de dic, 2011 - 18:59 Safari 535.2 GNU/Linux

    ¿tiene soporte para SRW Iron?

  54. Avatar ilyas 22 de nov, 2014 - 01:08 Firefox 33.0 Windows 7


  1. WordPress WordPress Plugin Releases for 08/19 »   Weblog Tools Collection » Blog Archive | 19 agosto. 2008 - 4:10 pm

    […] UserAgent-Spy […]

  2. WordPress WordPress Plugin Releases for 08/19 | Wordpress Blog NL | 19 agosto. 2008 - 6:50 pm

    […] UserAgent-Spy […]

  3. WordPress Weblog Tools Collection: WordPress Plugin Releases for 08/19 : AllFeedz | 21 agosto. 2008 - 8:30 am

    […] UserAgent-Spy […]

  4. WordPress [17] ???? ??????? ??? WordPress (2) | 21 agosto. 2008 - 11:32 am

    […] UserAgent-Spy ?? ???? ????? – “????” ???? ??????? ? ?? ? ?????? ?????, ? ???? ?? ? ?????????, ????? ? ???? ??????. ??????? – ????? ? ?????? ?? ????????, ??? ???? ? ??? ?????????? ???? – ??????? ????? ????????. […]

  5. WordPress Weblog Tools Collection: WordPress Plugin Releases for 08/19 | Life Journey | 21 agosto. 2008 - 11:38 am

    […] UserAgent-Spy […]

  6. WordPress Tarde programando PHP para WordPress | Picando Código | 23 agosto. 2008 - 11:59 pm

    […] PHP. Se ha vuelto bastante entretenido la programación para WordPress. Tengo los dos plugins: UserAgent-Spy y List Category Posts en […]

  7. WordPress WordPress Plugin Releases for 08/19 · Softonix.com | 26 agosto. 2008 - 2:27 am

    […] UserAgent-Spy […]

  8. WordPress WordPress Plugin Releases for 08/19 | BlogBroker24-7 | 27 agosto. 2008 - 5:49 pm

    […] UserAgent-Spy […]

  9. WordPress WordPress: Posts of Note, August 2008 | BlogWell | 2 septiembre. 2008 - 5:10 am

    […] UserAgent Spy WordPress plugin UserAgent-Spy is a WordPress plugin which displays the user’s Operative System and Web browser in the comments section. […]

  10. WordPress ?WordPress???Google Chrome | 14 septiembre. 2008 - 5:39 am

    […] ?????????????????Chome???UserAgent-Spy??????????????????????????????????????????????????????????????????????????????????? […]

  11. WordPress Browser Sniff Plugin Detects more Browsers and Operating Systems - Dani Iswara .Net | 9 mayo. 2009 - 4:38 am

    […] UserAgent-Spy WordPress Plugin (English) by picandocodigo.net. […]

  12. WordPress UserAgent-Spy review, discussions, does it work, and ratings on Loadwp.com | Loadwp.com | 17 agosto. 2011 - 7:41 pm

Dejar un comentario

Notificarme los nuevos comentarios por correo electrónico. Tambien puedes suscribirte sin comentar.