Add Google Analytics code to Wordpress

There are a good number of plugins to add Google Analytics code to WordPress, but I did the following:

Edit

header.php

Paste your tracking code directly after the opening tag

To edit header.php see the screenshot below:

googleAnalyticsWordpress

Click on “Theme Header” on the right side of the screen