If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)


Featured templates

How to install Google Analytics on WordPress

Starting your website you could have three crucial questions:

  1. Who is visiting your site?

  2. What posts are the most popular?

  3. And how people interact with your site?

We are going to show you how to gather that information in this tutorial. To get that info, you can use Google Analytics. There are different ways to use Google Analytics on your website. We will discuss them further.

How to get Google Analytics code?

  1. The first step is Google Analytics account setup. Please, visit Google Analytics Signup page. If you already have Gmail account, you can use it to sign in.

  2. You will see the following page on your screen. Click on Sign Up button.

  3. Now you can proceed to the next step. Click Website tab on the page you see and start entering your account information:

    • Account Name;

    • Website Name;

    • Website URL;

  4. Once you are ready, click on the Get Tracking ID button to get Google Analytics tracking code. You will see the ‘Terms and conditions’ pop-up, click on the I Agree button to be able to get the code.

  5. You can see Google Analytics code now. Copy it to paste it into your website. You can leave this page opened to be able to get this code easily.

How to insert Google Analytics code?

We already mentioned that there are several ways to add Google Analytics Tracking code to WordPress website. So what are they?

  1. Using MonsterInsights plugin.

    • To install MonsterInsights plugin, log into your WordPress admin panel, and navigate to Plugins > Add New section. Enter Google Analytics by MonsterInsights into the search field.

    • Install and activate the plugin.

    • Navigate to Insights > Dashboard section in your backend and authenticate your website with Google Analytics by clicking the Authenticate with your Google account button.

    • Click To Get Google Code button in the pop-up. Give MonsterInsights access to your Google Analytics data by clicking Allow. Copy the code and switch to your application to paste it.

    • Select your account from Select the Google Analytics Profile to Use drop-down and click the Close button.

    • Now, visit Insights > Dashboard to see Google Analytics data. You may need to wait up to 24 hours to get data populated there.

  2. Using Insert Headers and Footers Plugin plugin.

    • Open the Plugins > Add New page and search for the Insert Headers and Footers Plugin. Install and activate it.

    • Navigate to Settings > Insert Headers and Footers page.

    • Here you need to paste Google Analytics code into the header or footer box.

    • Click ‘Save’ to save the changes.

  3. Insert Google Analytics tracking code to the theme files. You can do that in case you don’t want to use additional plugins or if you’re familiar with the code. There are 2 ways to add code:

    • Simply edit the header.php file under Appearance > Editor section in your WordPress dashboard.

      Enter the code just after the <body> tag and click on the Update file button to save the changes.

    • Or you can modify theme functions.php file. You can access it from the same Editor page. Use following function to add Google Analytics tracking code:

          add_action('wp_head', 'wpb_add_googleanalytics');
          function wpb_add_googleanalytics() {?>
          // Paste your Google Analytics code 
        <?php } ?>

      Where // Paste your Google Analytics code is your Google Analytics code.

That is it! You know how to install Google Analytics on WordPress now.

We would also suggest you to check out the latest collection of WordPress themes to build your very own website.

Live Chat
We help you to choose the right product.
Start chat