fix analytics code