add analytics and fix bug when scrolling