Add Google Analytics to WordPress in 2 minutes

The following is the fastest way to integrate Google Analytics with your self hosted WordPress website without using any external applications or plugins. By injecting plain javascript into your tag, you won’t have to worry about incurring the overhead of adding a new plugin to your site for a small 2 line code addition.

Open the header.php file from your WordPress theme that you are currently using and add the Google Analytics embed code from the Google Analytics page.
Admin -> ACCOUNT -> PROPERTY -> Js Tracking Info -> Tracking Code.
Copy that Tracking Code and add it right after the <head> in the following way.



Now save the file and clear your cache if you are using a caching plugin.
You should be able to test REAL-TIME -> Overview from your Google Analytics Account now.