Where is the best place to catch useragent?

You can use the filter template_include. wp-includes/template-loader.php is where template is included.