In this article, discover how to integrate Google Analytics into a WordPress site. Google Analytics enables website owners to monitor and examine their site’s visitor data. There are several methods to link a WordPress site to a Google Analytics account.
- Add Google Analytics to WordPress without plugin
- Add Google Analytics to WordPress with a plugin
1. Add Google Analytics to WordPress without plugin
To monitor your WordPress site with Google Analytics, you need to include the tracking code in the header section of your WordPress theme.
Note: You need to have a Google Analytics account prior to starting the setup outlined below. If you haven’t created an account yet, you’ll need to create an account.
- Access your Google Analytics account and copy your tracking code snippet.
- Access your WordPress files via hosting or FTP.
- 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.
2. Add Google Analytics to WordPress with a plugin
You have the option to configure your WordPress site with Google Analytics through a plugin, rather than inserting the tracking code directly into your files. One plugin that can assist in this task is MonsterInsights’ Google Analytics for WordPress plugin. Keep in mind that whenever you consider adding a new plugin, it’s important to review the developer’s page to see if they are actively maintaining it with updates.
If you haven’t set up a Google Analytics account yet, you will need to start by create an account.
- Log in to WordPress.
- Install & Activate the plugin. Follow the YouTube video Plugin | Step by step video on How to Install & Activate a WordPress Plugin | Hosting Column.
- Locate the new sub menu in your main Settings menu labeled Insights, and click it.
- Click Settings under Insights.
- Then click Authenticate with your Google Account.
- Now click Next.
- And then click Click to Get Google Code
- If necessary, login to your Google account when prompted.
- Click Allow
- Copy the code that is provided.
- Return to the browser window with your Insights settings and paste the code where it says “Paste Google Code Here“.
- Click Next.
- Select the Google Analytics profile you want to use.
- Click Next.
- Click Close.
You can integrate Google Analytics into your WordPress site and begin tracking your site’s visitor traffic in these ways.
Thanks for visiting. For queries and suggestions, emails are welcome at learnweb@hostingcolumn.com.
Subscribe to Hosting Column for the latest updates and posts.