added click and view tracking, to be tested
fixed bugs for updating stats