moving analytics code to domready