After starting a blog, you may want to measure its traffic and perform SEO-related tasks: it’s a must to optimize your WordPress site for SEO if you want to get traffic from Google Search and other search engines. The good news is that there are free Google tools to help you get started – Google Search Console (GSC) and Google Analytics (GA).
GSC is a free and essential tool that provides information on website traffic coming from a web search, helps fix website issues, measure keyword performance, etc. It also has a feature to submit a sitemap and directly request Google to index new or updated pages of your site.
Another essential tool you should be using is GA, which provides information about visitors and their behavior: how they interact with your site, how much time they spend on it, where they’re coming from, etc.
In this tutorial, I’ll show you how to easily add a WordPress site to Google Search Console and Google Analytics so you’ll be able to start using these powerful SEO tools right away.
Set Up Google Analytics
First, keep in mind that you’ll need a Google Account (if you use Gmail, then you already have one) before setting up GA and GSC.
Create Google Analytics Account
After you sign in to Google, go to the Google Analytics website and click Start measuring.
In the Account setup section, enter the Account name (this can be your company name), select the preferable Account Data Sharing Settings (I recommend selecting all), and click Next.
In the Property setup section, enter Property name (it can be your website URL), select the preferable Reporting time zone and Currency, and click Show advanced options. Under the advanced options, I strongly recommend creating a Universal Analytics property: some SEO plugins, such as Rank Math SEO, still don’t support the latest GA version (GA4), in which case you need to create an older version. However, there’s an option to create and use both versions simultaneously: enter your website URL, and choose the option that says to create both GA4 and a Universal Analytics property (additionally, select Enable enhanced measurement for Google Analytics 4 property). Then, click Next to continue.
In the next section, fill in your business information, select your intentions to use GA, then click Create.
When the Google Analytics Terms of Service Agreement window appears, tick everywhere that you agree to all the terms.
Add Google Analytics code
On the next page under the Add new on-page tag tab, click on Global site tag (gtag.js): here, you’ll see the GA JavaScript code that you’ll need to paste into the <head> section of your HTML – copy this code to your clipboard.
Log in to your WordPress dashboard, go to Plugins → Add New, search for Insert Headers and Footers by WPBeginner, then click Install Now and Activate. This plugin allows you to edit the site header and footer.
Now, go to Settings → Insert Headers and Footers, and under Scripts in Header, paste your previously copied GA JavaScript code. Click Save.
At this point, you need to make your GA code appear on your site immediately before proceeding with the following steps: if you use any WordPress cache plugin, you must first clear its cache. The same goes for any external caching services, such as Cloudflare. After purging the cache, reload your website to update its content. See the examples below on how to clear the Breeze and Cloudflare plugin cache (other cache plugins should have similar features too).
If you use the Breeze plugin, find and click the Purge All Cache option.
If you use the Cloudflare plugin, find the Purge Everything option.
Then, reload your website to update its content with the GA code.
Create Google Search Console account
The next step is to create a GSC account: go to the Google Search Console website and click Start now.
You’ll need to select one of the GSC property types to verify your website ownership: the Domain or URL prefix property. The Domain property – it’s a domain-level property that includes multiple protocols (HTTP, HTTPS, FTP, etc.) and all subdomains. The URL prefix property includes only URLs with the particular protocol and prefix, e.g., https://www.yourdomain.com/store. I recommend choosing the URL prefix property because it gives you more options to verify your ownership and is the recommended verification method if you use a WordPress SEO plugin.
Enter your website URL in the URL prefix section, e.g., https://www.yourdomain.com, and click Continue.
Then, choose the Google Analytics option to verify the ownership.
After the successful ownership verification of your website, click Go to property and start exploring GSC features.
And that’s it! From now on, you can track your site’s traffic with two powerful Google tools. However, for the best experience, you should install a WordPress SEO plugin such as Rank Math, which can automatically submit sitemaps to GSC and facilitate other SEO-related tasks.
Frequently Asked Questions
Why is Google Search Console or Google Analytics not showing data?
After you set up the Google Search Console and Google Analytics, it can take up to a few days to process the data, so you may not see your site traffic statistics right away.
Can site ownership be verified automatically using a WordPress SEO plugin?
Yes. Some WordPress SEO plugins have the option to add your website to Google Search Console and verify the ownership simultaneously. However, it’s still better to do everything manually as it gives you more control.
How can I check if Google has indexed my site?
The easiest way to check if Google has indexed your site is by searching for your site’s exact URL or domain name on Google, e.g., “site:yourdomain.com”. However, keep in mind that if your website is brand new, it can take a while (usually, between four days and four weeks) before it gets indexed: many factors determine how quickly it will appear on Google Search, so you may have to wait.