EasyWP: How to add Google Analytics to your site

What is Google Analytics?

Google Analytics is a free web service provided by Google that allows website owners to learn more about their website visitors through traffic statistics.

Signing up with Google Analytics

Before adding Google Analytics to your WordPress site, you will need to sign up for the service:

1. If you are not logged into your Google account or don’t have one, you will see the following screen:



2. Sign in using your Google or Gmail account. If you don’t have one, select More options, then Create account.

3. Once signed into your Google account, click the Start measuring button:



4. Complete the registration form:









In a pop-up window, you will see the Google Analytics Terms of Service (TOS) Agreement. Read the TOS and click I Accept:



To set up data collection for the website or app, it is needed to choose from where you will be collecting data (the Web, an Android app, or an iOS app). Next, you’ll get instructions for adding a data collection tag to that source. In our example, we selected Web option:



Then you need to enter Website URL, enter the Stream name and click on the Create & continue button:





On the next step, you can find the instructions on how to add Google Analytics to a WordPress site using the Site Kit plugin.



Adding Google Analytics to a WordPress site using a plugin

There are a number of plugins that may be used for easily adding Google Analytics to a website. This guide shows how to add Google Analytics using the Site Kit by Google plugin. However, you can use a similar installation plugin of your choice.

1. From your WordPress admin dashboard, install the Site Kit by Google plugin.

2. Once the plugin is installed and activated, navigate to the Site Kit menu and click Dashboard:



3. Connect Site Kit to your Google account and check the box “Connect Google Analytics as part of your setup”:



4. Select the Google Account with an existing Google Analytics property.

5. Click Continue to grant access to Google account data:



6. After you grant permission, click Proceed to verify site ownership:



7. Click Next on Set up Google Analytics:



8. Choose your pre-existing analytics property, then click Complete Setup:



Now you'll be able to view your Google Analytics data from within your WordPress dashboard via the Site Kit Dashboard.

Adding Google Analytics to WordPress manually  

You may add Google Analytics tracking code to the header.php file of a WordPress theme. This method should only be used by advanced users as it requires familiarity with code. Moreover, it is important to remember that once a WordPress theme is updated or switched, it will be necessary to add the code again.  

1. From your WordPress admin screen, navigate to the Appearance menu, then click the Editor option:  

 

2. On the right-hand side of the screen, click the Theme Header (header.php) template:  

 

3. Find the <head> tag. Paste the code snippet obtained in your Google Analytics dashboard right before the closing tag. Click the Update File button:

 


That's it!


EasyWP is Namecheap's fast and reliable Managed WordPress Hosting solution.




Need any help? Contact our HelpDesk


Updated
Viewed
40888 times

Need help? We're always here for you.

notmyip