Adding Google Analytics to your WordPress website can give you insightful data about your website’s visitors and their interactions.
Here’s a simple step-by-step guide to do it:
Option 1: Using a Plugin (For Beginners)
1. Install a Plugin: Go to your WordPress dashboard, click on “Plugins” > “Add New”. Search for “MonsterInsights” (a popular choice) and click “Install Now”, then activate it.
2. Set Up Google Analytics: Once activated, MonsterInsights will prompt you to connect your Google Analytics account. Follow the on-screen instructions to authenticate and select the profile you want to track.
3. Configure Settings: After linking, go through the configuration settings to tailor the tracking to your needs.
Option 2: Adding Code Manually (For Advanced Users)
1. Get Tracking Code: Sign in to your Google Analytics account and select the property you’re working with. Go to “Admin” > “Tracking Info” > “Tracking Code”. Copy the Global Site Tag (gtag.js) script.
2. Paste Code in WordPress: Access your WordPress dashboard, go to “Appearance” > “Theme File Editor”. Find the header.php file and paste the tracking code just before the closing </head> tag.
3. Update File: After pasting, click “Update File” to save changes.
Testing Your Setup
- After adding Google Analytics to your WordPress site, test if it’s working by visiting your site and then checking the “”Real-Time”” report in Google Analytics to see if your visit is recorded.
Remember, using a plugin is the easiest and safest method for beginners, as it prevents potential errors that can come from directly editing theme files.