Does PIWIK count the visit time, if the browser tab is not active? If not, is it possible to count the time, the user is actively using the website?
Yes, it is possible and was introduced in one of the recent Piwik versions. See: http://piwik.org/faq/how-to/#faq_21158