Implementing Google Analytics with Nginx

Have you deployed a website for your client so fast that you forgot to add Google Analytics tracking?

That happened to me.

I did some digging around and found there is a way to implement google analytics within Nginx (and maybe apache too). I’m using it for a few clients and wrote down the steps for anyone who wants to use the same method.