Add analytics code to layout