added optional analytics tracking