Spring Sales 20% discount on all products, use coupon: SPRINGCSV20

How to Install Google Analytics in WordPress?

how-to-install-google-analytics-in-wordpress

Do you own a website? If yes, you should track your visitors' interaction on the website. If you are looking for an effective way to track your website audience? Then give a try to Google Analytics. You will know where your website visitors are coming from, how long they stay on your website, what devices they are using, and much more with the help of Google Analytics. This article is about how to integrate your WordPress website with Google Analytics. At the end of this article, you will understand what, why, and how you can configure Google Analytics with your website.

What exactly is Google Analytics?

It is a free and best website analytics tool. Google Analytics provides real-time statistics about your website traffic and user interaction. Small and Medium businesses use it to track traffic sources and website performance. In addition, it gives complete demographics of your site visitors to analyze them more deeply.

google-analytics

With google analytics, you can find your marketing efforts' effectiveness or success rate by analyzing the quality of traffic you're receiving and tracking goal completions. For example, if you want to know who comes to your website, what they are doing after landing on pages inside your website, how long they stay, and what content gets more traffic, you can try google analytics. In short, analyzing your customer behavior with GA helps you develop enhanced marketing campaigns, gain website traffic and retain your site visitors.

Why do you need Google Analytics for your website?

You need Google Analytics to know how your site is performing. There are many benefits to using Google Analytics. Google Analytics can be able to track any kind of WordPress website.

It gives you complete user demographics and their location details. That is, you can know your visitors' details like where they come from, which channel they use (like search, paid, etc.,) and more. You can track the behavior of your customers after landing on your website. You can see the pages they visit, files downloaded, and more. GA helps you track the conversions and revenue your store makes and Pages & Posts visits. It shows which devices your site visitors use most. So you can improve your site experience by adapting to the device your users use.

Significant Metrics to track in Google Analytics

All the reports generated inside Google Analytics for your website are built with dimensions and metrics. Metrics typically are quantitative measurements. Therefore, the results will be in numbers. For example, the total number of visitors viewed a particular page. Here we have listed the top key metrics that you need to track in Google Analytics to measure the strengths and weaknesses of your site.

  • 1. Users: Users are the visitors or viewers of your website. It’s categorized as two, which are New and Returning visitors. New Visitors are visitors who landed for the first time on your website. On the other hand, Returning visitors are those who have already visited your website. With the help of cookies, Google Analytics differentiates users' data. But the data is not 100% accurate. It’s possible to count the already visited visitors as new Users if they access in separate devices or browsers, access in incognito mode, or delete the cookies. Check the User Metrics in Google Analytics in the ‘Audience → Overview.’
  • 2. Live Visitors Location Tracking and User Activities: You can easily track your visitors' count in real-time. The stats will show how many active users are on your site, top active pages, top location, top referrals, top social traffic, top keywords, and page view. Live Location tracking shows the count of visitors based on countries' location and pageviews details. It also gives in-depth location details like active visitors count in cities of the selected country. To know this, visit ‘Realtime → Locations’ in your Google Analytics dashboard.
  • 3. Bounce rate: Bounce rate is the total percentage of visitors who leave without navigating to other pages on your website. It is also known as single-page sessions. You can view this metric in ‘Audience → Overview.’ High bounce rate reflects cases like your site content doesn’t satisfy the visitor need, the page with no internal links, or it may indicate technical issues.
  • 4. Sessions: A session is a group of interactions a user takes within 30 minutes after landing on your website. It may contain multiple page views, events, social interactions, and transactions. It is possible for a single user can open multiple sessions. To know how many sessions you have earned in a period, visit ‘Audience → Overview.’ You will find the total number of sessions created in a specific period.
  • 5. Average session duration: It measures the average length of the sessions. You can find the average session duration in some of the reports in Google Analytics. It is related to how visitors view your websites and pages. Find that in ‘Audience → Overview”. Visit the ‘Audience → Mobile → Overview’. This report shows the average session duration by device category. Visit Behavior → Site Content → Landing Pages to see the average duration of the session for landing pages. The session duration average is 2-3 minutes. The session duration average above three minutes is considered a good average.
  • 6. Percentage of new sessions: It measures the rate of sessions newly created by users visiting your website for the first time. You can find the percentage of new sessions in ‘Audience → Behavior → New vs. Returning’.
  • 7. Pages per session: Pages per session are valuable metrics to track. It shows the average number of pages your website visitors viewed in one session. View it by visiting ‘Acquisition → Overview”. Here it’ll show the pages per session for each channel. It’ll be helpful to know which channels get the most engaged users to your website.
  • 8. Goal completions: The number of defined activities completed by visitors. It is categorized into four types: destination goals, duration goals, pages/screens per session goals, and event goals. Track your goals on Conversion → Goals → Overview.
  • 9. Page views: Defines the total number of pages viewed on your website. Get to know your top page users visiting your website inside your WordPress website. Else visit ‘Behavior → Site Content → All Pages’ to know page views count for all your pages.

Install Google Analytics to WordPress using Plugins

Many plugins are developed for adding Google Analytics to WordPress. Adding Google Analytics in WordPress using a plugin is an easy process. If you are a non-developer WordPress user, you can give it a try to any one of the plugins listed below.

Before installing any plugins, make sure you have a google analytics account. If you don't have one, follow the upcoming steps below.

How to Sign Up in Google Analytics

Initially, log in or sign in to your google account. If you have no Google account, sign up for a new one immediately. Undergo the steps listed below to configure Google Analytics for your website.

google-analytics-page
  • 2. Provide the required information on the Account setup page. The account name you give will be the profile name for your website. In addition, you can use your business name.
account-setup-google-analytics
  • 3. Check all the checkboxes of 'Account Data Sharing Settings' to control how google can share your Google Analytics data and click Next.
  • 4. New Property Setup
property-setup-google-analytics
  • 5. You need to enter your website property details on the property setup page. Mention a name for your google analytics property. You can give the website domain name. Choose the time zone and currency.
  • 6. Select the 'Show advanced options' text link to configure the Universal Analytics property and enable the 'Create a Universal Analytics Property'. Next, enter your website URL. Finally, choose 'universal analytics property only.'
create-universal-analytics-property-google-analytics
  • 7. Skip the 'About your business' section if you don't want to configure it now. Otherwise, provide information about your company, such as industry type and business size.
  • 8. Click the 'Create' button to finish the setup. It pops up the Google Analytics Terms of Service. Check the box and click 'I Accept' to accept the conditions.
  • 9. The next page will show your site's Tracking ID and Tracking code.
  • 10. Leave this browser tab open to revisit often to copy the tracking code.

Method 1: Install Google Analytics using the MonsterInsights plugin

monsterinsights-banner

MonsterInsights is a popular WordPress plugin that lets you easily connect Google Analytics with your WordPress website. Install and activate the MonsterInsights plugin. Download the accessible version of this plugin from your WordPress dashboard by navigating to Plugins > Add New. In the search area, type ‘monsterinsights,’ the plugin will be shown first in the result. Select ‘Install’ and then activate the plugin. Check our article to know how to install a WordPress plugin.

why-wordpress-plugin

If you have installed the plugin, you can view the plugin menu 'Insights' in the left sidebar of your dashboard. It will show the launch setup wizard popup. Select it to configure the plugin.

It will show the welcome page to set up MonsterInsights. Firstly, choose your website category to see categories like Business Website, Publisher, and ECommerce. Then, click 'Save and Continue.

The next page connects google analytics with your WordPress site using the MonsterInsights plugin.

Secondly, provide your license key to activate the pro pack of the plugin. Click 'Connect MonsterInsights'. This will bring the 'sign in with google window'. Select your google email account. Then choose ‘Allow’ to allow the MonsterInsights plugin to access your Google Analytics account.

Pick a profile from the dropdown that you want to monitor and click 'Complete Connection.' Google Analytics will be installed on your website.

It will ask you to configure the recommended settings. Here you can add affiliate links paths. It will help you to track those affiliate links in Google Analytics. Then click ‘Save and Continue.

The page shows paid addons that you can use if you are using the paid version on the next page. You can skip this section by clicking the ‘Save and Continue button. Otherwise you will be asked next to install the WPForms plugin. The same author of MonsterInsights creates the WPForms plugin.

Directly install the WPForms plugin using the ‘Continue & Install WP Forms’ button. Otherwise just skip this section. That’s it, you have successfully installed Google Analytics inside your WordPress. You will be notified on the screen that it can take a few hours to display reports about your website. Read it and click the ‘Finish Setup & Exit Wizard’ button to complete the plugin setup.

Now you can view the reports inside your WordPress website. First, visit the page ‘Reports’ listed from the Insights menu. Then, simply navigate to the Insights > Reports. You will get a quick outlook of your website analytics.

You can get a quick overview of your website stats inside the separate widget named ‘MonsterInsights’.

Without leaving the WordPress website, you can see how your site performs. In its dashboard, you can view stats about page views over time, top-performing posts & pages, top traffic sources, top countries, and real-time stats. Moreover, you can avail of additional tracking features in the free versions like demographics, enhanced link attribution, file downloads, eCommerce tracking, and custom dimensions.

The premium version offers enhanced tracking options like Ads tracking, Youtube google analytics, Vimeo Google Analytics, HTML5 Video tracking, Custom Post Type Tracking, Email summaries, GA for AMP, GA for Facebook Instant Articles, Google Analytics GDPR Compliance, Form Conversion Tracking, and lot more. Get MonsterInsights Pro here.

Method 2: Using Google Site Kit

Google Site Kit is another excellent WordPress plugin that you can connect Google Products with your WordPress site. Install this plugin to know where your visitors are coming from and how they are using your website. The site kit plugin integrates and fetches data from Google Products like Google Analytics, Google Search Console, Google Adsense, and PageSpeed Insights.

With the analytics integration, you can track your visitor's navigation through your website and their completed goals. It shows stats for the entire website and every individual post. Use this plugin to set up multiple Google Products inside WordPress without code on your site.

This plugin is available for Free. First, get the Google Site Kit plugin for free from wordpress.org. Then, install the plugin in your WordPress. The menu ‘Site Kit’ will appear on the left side menu.

google-site-kit-banner

Once the plugin is installed, you can see a ‘Start setup’ button visible on the plugins menu page. Simply click the button. You will need to connect to your Google Analytics account. Then undergo a few simple steps to authenticate you’re the domain owner. Provide access to your Google Accounts data for the plugin and set up the Google service you want to add to your site. After you connect and set up the plugin, you can track Google Analytics data inside our WordPress dashboard. If you want more features for Google Analytics, you can look for other popular plugins mentioned in this article.

Method 3: Add Google Analytics with the Google Tag Manager plugin

Google Tag Manager or GTM is a tag management WordPress plugin. It is helpful if you have more than one site and want to add tags(or tracking codes) to those websites for different purposes. Google Analytics is one of the tracking codes where Google Tag Manager manages all tracking codes. It lets you easily add, edit or delete tags or Google Analytics tracking code on the website.

Rather than editing your website code, it’s just easy to add or update scripts inside the Tag Manager plugin interface. This saves you from getting errors and time-wasting in looking for developer help. Download Google Tag Manager free plugin. Sign up for a new GTM account. Create the first container and copy the container ID. Navigate to the manager dashboard → Admin. Search for a series of characters starts with the letter ‘GTM’.

google-tag-manager-banner

Paste the GTM ID into the required related field on the settings page inside your website dashboard. Then, visit it by moving to Settings > Google Tag Manager. The tags you set up in Google Tag Manager will now work on your website.

Method 4: Using GA Google Analytics

This plugin provides the quickest way to add tracking codes to your website pages. It also includes a tracking code inside the header and footer of your website. Install the ‘GA Google Analytics’ plugin on your WordPress site. The plugin supports tracking options such as Universal Analytics, Google Site Tags, and Legacy. We have to add a Google Analytics tracking ID in the plugin settings to activate Google Analytics for the website.

Install and activate the plugin on your website. Next, we need to add a tracking code. Visit the Google Analytics account for your website and click Admin. Choose Data streams and select any one data stream. There you can see the Measurement ID. You can copy and use this measurement ID in the place of tracking ID.

Further move back to your WordPress dashboard, visit Settings → Google Analytics, and scroll down to visit the Plugin Settings section. Paste the copied tracking code in the GA Tracking ID field. Configure other details and click Save changes. Google Analytics is now activated for your WordPress site.

Method 5: Using Insert Headers and Footers Plugin

insert-headers-and-footers-plugin-banner
Photo By WPBeginner on wordpress.org

This plugin doesn't have any advanced tracking features. Similarly you can't view your Google Analytics data inside your website. It just lets you paste the tracking code to enable Google Analytics for your website.

In your WordPress dashboard, install and activate the plugin. Get the FREE version of the Insert Headers and Footers Plugin here. After you activate, navigate to the Settings menu and select ‘Insert Headers and Footers.’ Paste the copied Google Analytics tracking code inside the ‘Scripts in headers’ section. Once done, click Save changes. That’s it, you have installed Google Analytics on your website.

To get tracking code in Google Analytics 3, follow these steps below:

  • First, visit the admin inside your Google Analytics account.
  • Move to ‘Tracking Info → Tracking Code”.
google-analytics-settings-page
  • There you will find the tracking code. Copy the code to use it wherever you require.

Follow the steps to get tracking code in Google Analytics 4

  • Select ‘admin → Data Streams”.
select-data-streams-in-google-analytics
  • Click on any one data stream.
  • In the Tagging Instruction section, click the Google Site Tag tab. It will reveal the tracking code. Just copy the code to use it.
web-stream-details-global-site-tags

Install Google Analytics in WordPress Themes (Not using any plugin)

If you are familiar with coding or a developer, you don’t want to use any plugin to add Google Analytics to a website. You can try this method.

Get your tracking code by following any of the methods mentioned earlier. Next, login to your WordPress admin dashboard and locate the ‘Appearance → Theme File Editor’ tab.

You will see all files of your WordPress site are listed on the right side. The selected file codes will be displayed in the middle of the page.

Now add the copied code inside the header.php file. Paste the code before 'head' tag. The code will be applied to your entire site. If you want to use tracking code on particular pages, just select the specific page and add the code inside it. After that, click ‘Update File’.

Add tracking code in functions.php

You can also include the tracking code in the functions.php file. It will add the code to every page automatically. Select the functions.php file from the right-hand side and paste the code inside the code editor.

edit-theme-functions-in-wordpress

How to check GA Tracking code on your website

After you have added the code to your website, how will you confirm the Google Analytics installation is successful or not. Here we have listed some steps to verify the Google Analytics installation on your WordPress site.

check-ga-tracking-code-on-website
  • You need to ensure that the google analytics script on your WordPress dashboard is visible somewhere on your site.
  • Visit any pages of your website.
  • Just right-click inside any page area and select ‘view page source.’
  • You will see the code of the website.
  • Search for the text ‘google.’ You can use the keyboard shortcut ‘Ctrl+F’(for windows) or ‘command + F’(for mac).
  • Or copy and paste the tracking id(or measurement id) inside the search box to find the results.
  • You can view the google analytics code mentioned in scripts.
  • If you don’t get any results, your google analytics code is not installed correctly.

View Google Analytics Reports

Google Analytics generates and shows reports based on the data collected from your website. You can view the reports directly inside the dashboard. It will offer real-time acquisition, audience, behavior, and conversion reports.

The real-time report will get and show the real-time or current view of your site traffic. The reports in the audience sections will be helpful for you to understand your users or site visitors. In the acquisition reports, you can know where the most traffic is coming from. The behavior report shows what the visitors do after they land on your site. With the conversion report, you can track your goals and how well they are going.

Conclusion

To sum it up Google Analytics has many more features that help optimize your site performance for your visitors. It is undoubtedly an excellent tool for business owners to know their audience and what/where they need to target to get more engagement and conversions. I hope this article explains all you need to know about installing Google Analytics on your site. Suppose you have any questions feel free to ask us at [email protected]. We'll be happy to assist you. Also, if you are looking for WordPress customization, we have expert teams to fulfill your requirements.

spring Banner img (1)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.