Refactor analytics into separate internal lib (main functionality) and public api (instance with track function)