How can you add Google Analytics tracking code to a WordPress website?

In this article we are going to talk about How can you add Google Analytics tracking code to a WordPress website? Google Analytics is a powerful tool that helps you understand how your website is performing, how visitors behave on your site, and how your marketing efforts are paying off. By integrating Google Analytics into your WordPress website, you can gain a deeper understanding of your audience and make data-driven decisions to improve your site’s effectiveness.

How can you add Google Analytics tracking code to a WordPress website?

In this article, we will walk you through the process of adding the Google Analytics tracking code to your WordPress website.

Step 1: Sign up for a Google Analytics Account

To start, you’ll need to create a Google Analytics account. If you don’t already have one, visit the Google Analytics website ( and sign in with your Google account or create a new one if necessary. Once signed in, click on the “Sign up” button to start the account creation process. Google will guide you through the necessary steps to set up your website’s tracking property.

Step 2: Obtain the Tracking Code

After creating your Google Analytics account, you’ll need to obtain the tracking code. From the Google Analytics dashboard, navigate to the Admin section by clicking on the gear icon in the bottom left corner. In the Property column, click on “Tracking Info” and select “Tracking Code.” On this page, you will find the tracking code snippet that you need to add to your WordPress website. The code snippet consists of two parts: the script tag that loads the Google Analytics library and the configuration code that initializes the tracking.

add google analytics tracking code to wordpress

Step 3: Install and Activate a Google Analytics Plugin

To simplify the process of adding the tracking code to your WordPress website, we recommend using a Google Analytics plugin. There are several plugins available that can help you with this task. For the purposes of this guide, we will use the popular “MonsterInsights” plugin as an example.

To install the plugin, log in to your WordPress dashboard, navigate to the “Plugins” section, and click on “Add New.” In the search bar, type “MonsterInsights” and press Enter. Look for the “MonsterInsights” plugin in the search results and click on the “Install Now” button. Once the installation is finished, simply click the “Activate” button to activate the plugin.

Read Also: What is a theme in WordPress and how can you choose the right one?

Step 4: Configure the MonsterInsights Plugin

After activating the MonsterInsights plugin, you need to configure it with your Google Analytics account. This step allows the plugin to establish a connection and retrieve the necessary information from your Google Analytics account.

To begin the configuration process, go to the “Insights” section in your WordPress dashboard and click on “Settings.” On the settings page, you will find an option to authenticate your Google account with the plugin. Click on the “Authenticate with your Google account” button, and follow the instructions to grant the necessary permissions. This will connect your Google Analytics account to the plugin.

Once the authentication process is complete, you will see a list of websites associated with your Google Analytics account. Select the website you want to track from the drop-down menu. This will ensure that the plugin fetches the correct tracking code for your website.

Read Also: What are the essential plugins for a WordPress website design?

Step 5: Add the Tracking Code

With the MonsterInsights plugin properly configured, you can now add the Google Analytics tracking code to your WordPress website.

From your WordPress dashboard, navigate to the “Insights” section and click on “Tracking.” In the “Tracking Code” tab, you will see a toggle switch labeled “Manually enter your UA code.” Enable this switch, as it allows you to manually add the tracking code snippet.

Next, copy the tracking code snippet obtained in Step 2 and paste it into the text box labeled “UA Code.” Ensure that you copy the entire code snippet, including both the script tag and the configuration code. Once you’ve pasted the code, click on the “Save Changes” button to apply the settings.

How to add Google Analytics code in WordPress with plugin

Step 6: Verify Tracking

To ensure that the tracking code is properly installed and functioning, it’s essential to verify the tracking on your website.

Open your website in a new browser tab and visit a few pages. Then, return to your Google Analytics account. In the “Reporting” section, navigate to “Realtime” and click on “Overview.” If your website is receiving traffic, you should see your own visit(s) listed under the “Realtime” section. This confirms that the tracking code is working correctly.


Adding Google Analytics tracking code to your WordPress website is a straightforward process that can provide you with valuable insights into your site’s performance. By following the step-by-step guide outlined in this article, you can seamlessly integrate Google Analytics and start tracking visitor behavior, traffic sources, and other important metrics. Remember to regularly analyze the data and use it to optimize your website, make informed marketing decisions, and ultimately improve the user experience. By leveraging the power of Google Analytics, you can unlock valuable insights and drive the success of your WordPress website. So, Now I hope you have understood about how can we add Google Analytics tracking code to a WordPress website.

You can also checkout this website designing institute to learn digital marketing course by enrolling in our course Or Contact Digital Bikana on +91-8949483728