How to add Google Analytics to your site

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 Sign up button: 



4. Complete the registration form: 


    

5. Click the Get Tracking ID button at the bottom of the page: 



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



You will then be redirected to a page where you can see your Google Analytics tracking ID and tracking code. 

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 Google Analytics Dashboard for WP plugin. However, you can a similar installation plugin of your choice.  

1. From your WordPress admin dashboard, Install the Google Analytics Dashboard for WP plugin.   

2. Once the plugin is installed and activated, navigate to the Google Analytics menu and click General Settings

   

3. You will be redirected to the Google Analytics Settings page where you must authorize the plugin to retrieve analytics data from your Google Analytics account. Do this by clicking the Authorize Plugin button:   

  

4. The next step is to get an access code. Click Get Access Code:   

     

In a new tab, you will be prompted to sign in your Google account (the same one you used to sign up with Google Analytics): 

   

Once logged into your Google account, allow the plugin to view the Google Analytics data by clicking the Allow button:   

   

Copy the code provided and paste it in the Access Code field on the plugin settings page, then click Save Access Code:   

   

   

Once done, click Save Changes button:   

   

Now you'll be able to view your Google Analytics data from within your WordPress dashboard via the Google Analytics Dashboard widget. Navigate to the Dashboard menu, then select Home.   



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 ead> tag. Paste the code snippet obtained in your Google Analytics dashboard right before the closing tag. Click the Update File button: 

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Increasing Wordpress upload size limit

By default the maximum file size for uploading in Wordpress is 2MB, which is quite small....