(hopefully) fixed analytics code