A recent post discussed free WordPress plugins for Google Analytics. Several of these plugins are easy to use and flexible, but another option for tracking WordPress is to add the Google Analytics tracking code directly into header.php.
To do this, you can open header.php in the editor and insert the tracking code just before the </head> tag. You can also add any customizations that you may need, such as for cross-domain tracking or Enhanced Link Attribution.
While a plugin may meet your needs in most cases, it’s good to have the flexibility of code editing when you might need it.