updated unit analytics query