adding analytics functionality