putting all analytics calls in 'onPrduction' method and fixed a different js error