counts events by type