Adding Google Analytics Code
Installing GA is easy... you can either put that info into a Global field, or include it as a separate Twig template.

As for general SEO... Check out the SEOmatic plugin or the Sprout SEO plugin.