added analytics logging