Add analytics function.