#110 moved analytics code to a shared partial, and generified for different environments