Refactor to move hostQuery into analytics.