Code for portal statistics