Add Google Analytics to WordPress
You can track your WordPress site in Google analytics by adding the tracking code to the header of your WordPress theme.
Note: You must have a Google Analytics account before you can set up this plugin. If you don't have an account, then you will need to set one up.
- Access your Google Analytics account and copy your tracking code snippit.
- Access your WordPress files via hosting or FTP. (cPanel / Plesk / Managed WordPress)
- Navigate to the /wp-content/themes folder for your WordPress site.
- Open the folder for the theme you are currently using on your site.
- Open and edit the header.php file.
If your theme does not have a file named header.php, then you will need to locate and edit the file that contains the wp_head() code.
- Paste your tracking code snippit just before the following code.
<?php wp_head();
- Save and upload the updated file.
- Visit your site so that traffic is recorded in your Google Analytics account.
- Check your Google Analytics reporting to confirm the file was correctly updated.
More info
- Return to Connect Google Analytics with WordPress
- For more information about our premium support for WordPress, please visit our WordPress Premium Support Catalog.