To add Google Analytics to your WordPress site, you can either do it within the WordPress administration or manually. We’ll show you how to do both in this tutorial.
Here’s how to do the first method:
1. Log in to Google Analytics and then go to Admin.
2. You must have already set up a domain name in analytics. Once you’ve done that, select Tracking Info, and then click Tracking Code.
3. You’ll need either the Tracking ID or the Website tracking code. Log into your WordPress Admin to add it there.
4. After that, we’ll install a plugin. Go to Plugins and then select Add New.
5. Search for Google Analytics. Click Install Now, then Activate Plugin.
6. After installing the plugin, go to Settings and then select Google Analytics.
7. It will prompt you to enter a Web Property ID; go back to the Google Analytics page and copy the Tracking ID.
8. Paste the Tracking ID into the Web Property ID and save the changes.
9. Analytics is now tracking your website.
10. If you use a premium theme, you might not need a plugin. This setting is probably already in place for you. To add the Google Analytics code, check the Theme settings to see if they have a Property ID anywhere. Copy the Tracking code for the website if it is not an Analytics code or a Property ID.
The second method is as follows:
1. We can manually add the analytics code via FTP. Login to FileZilla to get started.
2. Next, go to your Theme folder.
4. Look for header.php and right-click on it. Select View/Edit, then click OK.
5. You should insert the code just before the head closes. Go back to Analytics and copy the Website tracking code.
6. Paste the code just before the close tag, then Save the changes.
7. Analytics may take up to 24 hours to begin tracking. If it isn’t tracking, just check that the settings are correct.