added analytics handling