Add analytics to templates