Skip to content
How to insert Google Analytics code into WordPress

How to Insert Google Analytics Code into WordPress

If you want to create a professional website, the key point is to know what viewers want from your website. The best way to handle this is conduct access analysis, and Google Analytics can perform this task effectively. With statistical analysis, you can plan and create better contents for your readers. This tutorial will show you how to register and insert Google Analytics code into your WordPress website.

How to insert Google Analytics code into WordPress

How to insert Google Analytics code into WordPress

Why do you need to insert Google Analytics code into WordPress?

Everything will be easy if you know what users want from you, your website, and your service. There is only one way to get visitors to spend more time on your website than provide them what they need. This is exactly what Google Analytics can do and it's completely free of charge! Below are some reasons we recommend inserting Google Analytics code into WordPress and they will help you realize why every WordPress blog has it:

1. Determine user behavior

You can track your visitors' behavior with Google Analytics. You can easily notice which pages are most viewed, which ones are the most efficient, as well as determine which pages make your visitors exit immediately after landing onto them and more. It can also help you optimize your website even further. If a blog post gets more views than usual, you can write more about the same topic to attract more visitors.

2. Analyze high access times

You can easily determine which hours reach the highest traffic. If most users are active at night, obviously to get more views, you should choose to publish posts at night.

3. Discover important information

Google Analytics can also provide the smallest information - from the geographical location of any user to their language, the browser they use or even the resolution. Thus, it can help you understand your viewers more.

Although there are many other web analytics tools can be used, Google Analytics offers more exclusive features. Take a quick look at some of its prominent features below:

Create customer reports easily

The best way to analyze user behavior is based on facts and figures. This can be easily done by creating a report with an understanding – easily interface. You can add some parameters and metrics to create a better report.

Create Custom Alerts

This is a great feature of Google Analytics that you can send an arbitrary message in text or email whenever there is a sudden increase or sudden drop in the bounce rate. So you don't need to pay any attention to the dashboard to see important changes.

Integrated search console

Keeping an eye on SEO statistics is a matter of importance to do. Search Console is a tool that can provide information regarding search optimization. Integrating Search Console into Google Analytics will make it easier to retrieve information as well as faster to analyze them.

Only some features of Google Analytics can help you manage the entire process of WordPress website easily!

How does Google Analytics work?

Maybe you think that Google Analytics is incredible, but how does it do that? We know it will be helpful for you to have a basic knowledge of this software to understand it better, and take advantage of it more. Basically, Google Analytics includes:

1. JavaScript code

When a user accesses your website, JavaScript code will be executed to collect all information about the website, visitor information such as browser type, operating system, and screen resolution ...

2. Data collection service

When all the information has been collected by JavaScript code, it will be sent to Google servers for processing as a small package called hits. These hits are sent every time visitors open your website.

3. Data processing

During data – processing, Google Analytics servers will convert raw data into useful information of users. For example, classifying visitors based on their geographical location, language, screen resolution, device type and so on.

That's how Google Analytics code works. It seems very simple, but there are many functions run below and commands executed behind.

We hope this instruction will help you decide to insert Google Analytics code into your WordPress. Here is a tutorial that will assist you in adding Google Analytics to your WordPress website.

What do you need?

Before starting, you need to prepare:

Get access to WordPress Dashboard.

Step 1 - Create a Google Analytics account

The first thing you need to do is to create a Google Analytics account and get the tracking code. The steps below will show you how to register Google Analytics:

Get started by visiting the Google Analytics homepage. Click the Sign In button on the top of the page and select Google Analytics.

You will be redirected to the Login page. Enter your Google email address and click the Next button. If you don't have a Google account, create one by clicking the Create Account button.

On the next page, enter your password and click the Sign In button.

Click Sign Up button to continue.

To create a new account, you must fill in the following information:

  • Account Name.
  • Website Name.
  • Website URL.
  • Industry Category.
  • Reporting Time Zone.

Fill in all necessary data and click the Get Tracking ID button (6). On the next page, you will be asked to approve the Terms of Service, click I Accept.

That's it! You have successfully created a Google Analytics account. On the next page, you will see tracking code of Google Analytics Universal:

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  ga('create', 'UA-00000000-1', 'auto');
  ga('send', 'pageview');

This JavaScript code corresponds to all websites. Only ID tracking (UA-00000000-1) is unique. You will see your code on the same page. Tracking ID starts with Universal Analytics or UA for short. The first set of numbers is the account code (00000000) and the last number represents Google Analytics property ID (1).

Step 2 - Insert Google Analytics code into WordPress

One of the best plugins to insert google analytics code into WordPress is the plugin Analytics Code. This plugin will automatically insert Universal Analytics tracking code – you just need to enter the tracking ID.

The following steps will show you how to install the plugin and insert Google Analytics tracking ID:

Log in to Dashboard WordPress and install the Google Analytics plugin.

When the installation process is complete, navigate to the Settings section and click on Google Analytics Code.

Paste the code there and click the Save button.

So all this is done, the tracking code has been successfully installed on the WordPress blog.

Please note that it may take 12 to 24 hours for Google Analytics to update and begin displaying the first result. Then visitor statistics will be provided at the Google Analytics tab.


Google Analytics is a great tool for you to know how many visits on your website daily. It also gives you many information about the pages, time on site and user behavior. Using Google Analytics wisely, you're able to increase search rankings for your website. You might also want to check our free SEO tools and free SEO plugin for WordPress.

Leave a Comment

Scroll To Top