Learn how to install Google Analytics in WordPress without plugin and with a plugin. Add Google Analytics to WordPress to track number of visitors, traffic and other details of visitors on your site.
What is Google Analytics, why it is important
Google Analytics is a FREE tool which allows you to record, monitor and analyse traffic statistics of your site. Google Analytics is the answer for: who visit your site, what they are doing on your site, when they visit your site, from where they are coming to your site, how they are interacting with your site etc.
Following is the brief break-up of Google Analytics features:
Visitors’ demographic details: Language, country and city
Visitors’ System details: Browser, operating system and Internet Service Provider (ISP)
Mobile devices details: Operating system, screen resolution
This data could be helpful to serve your audience better. For example, you can optimize your website layout for all screen resolutions, as your site is getting traffic from all screen size devices. You can also make sure that your site is working fine on different mobile and desktop browsers.
Visitors’ activity details:
It gives you information about, which pages of website visited by visitors, how long they stay on the site. And what is the bounce rate (Bounce Rate is the percentage of single-page sessions in which the person left your site from the landing page without interacting with the page).
You can utilize this data to make your site more informative and make your content visitor oriented. Hence it helps to reduce the bounce rate, to increase visitor engagement and to increase pageviews.
Visitors’ visit time:
Monitor closely, around what time most visitors visit your site. You can utilize this data to publish new content. So that your new content reaches to more people instantly. And you can also avoid any design changes or any other changes (when more people visit your site) which can create inconvenience for visitors.
From where visitors are coming:
Google Analytics also gives data about, from where visitors are coming. A visitor can come to your site via Organic Search, Referral, Social or Direct.
- Organic Search: includes visits via search engines like Google, Yahoo, Bing, Yandex, Baidu etc.
- Referral: includes visits via other sites which are referring to your site.
- Social: includes visits via social media networks like Facebook, Twitter, Google+, Reddit, LinkedIn etc.
- Direct: Visitors who are directly coming to your site by bookmarking or by entering URL of the site.
Though every visitor who visit your site counts. But organic traffic is considered best especially if you are planning to display contextual ads on your site.
Google Analytics let you know about how many visitors are coming via each source viz. Organic Search, Referral, Social or Direct. It shows percentage-wise charts of visitors via all sources. Analytics also shows that on which pages of your site visitors (coming via these sources) are landing.
This data is really important. Because it tells you that which sources are fetching more traffic to your site. Accordingly, you can work on the areas which are driving more traffic and which are not.
How visitors are interacting with your content:
Google Analytics also shows that how visitors are interacting with your content. What percentage of the visitor is clicking which link. This allows you to fine-tune your design, layout and content structure to improve conversion rate and visitor engagement.
How to Sign-up with Google Analytics
Follow these easy steps to sign up for Google Analytics account:
- Go to https://analytics.google.com; You will be taken to the page like below.
Sign in with Google Analytics using your existing Google/Gmail account or create a new account using link Create account.
- Once you enter your Gmail account details. You will be directed to a page like below. On this page you can sign up with Google Analytics by clicking Sign Up button.
- On the next page there will be two choices. Would you like to track Website or Mobile App. Select Website and fill the details like: Account Name, Website Name, Website URL, Industry Category, Reporting Time Zone etc.
In the end of the page, there are Data Sharing Settings. These settings are to share the data with Google. As these Data Sharing Settings are absolutely optional, you may choose to enable or disable them.
Then click Get Tracking Id. You will be directed to next page as below.
- On this page you will see your Google Analytics tracking code under Website Tracking. Copy this code.
Now, you need to paste this code to WordPress in order to link your site with Google Analytics account. There are number of ways to add this code to your website. Let’s see, where we can paste this tracking code.
How to Install Google Analytics in WordPress
Google Analytics can be added to WordPress by three methods: Direct, Theme Hook Content and Plugin method.
Add Google Analytics to WordPress without Plugin
- Direct method: You can paste the tracking code in php file of your theme. To do this, you need to
Step 1: Go to Dashboard>Appearance>Editor
Step 2: Select theme to edit. And open footer.php by clicking it from right hand side files list.
Step 3: Paste the tracking code at bottom of footer.php file, just above the </body> tag. Click Update. And you are done.
- Theme Hook Content method: Some WordPress themes (like Themify themes for WordPress) offer a feature called hook content which allows you to insert code at various locations of theme layout. And this is done without editing the original theme files. To paste tracking code via hook content:
Step 1: Go to Dashboard>Theme Settings (Theme Panel)>Hook Content
Step 2: Add new code box by clicking Add New. Paste the tracking code and select the location wp_footer. Click save and you are good to go.
Add Google Analytics to WordPress using a Plugin
There are plenty of plugins available for Google Analytics. I recommend Google Analytics by MonsterInsights (formally known as Google Analytics by Yoast). Install and activate this plugin.
Note: If you have enabled Accelerated Mobile Pages (AMP) and using AMP plugin by Automatic. MonsterInsights plugin also helps to track AMP pages traffic as well.
Setting up Google Analytics by MonsterInsights:
Step 1: Go to Dashboard>Installed Plugins>GA by MonsterInsights Settings. Under settings you will see screen like below.
Step 2: Here you can Authenticate your Google Analytics account by Google Account on which you are using Google Analytics. Or you can manually enter UA code.
Step 3: Click save changes and you’re done.
I hope this guide will be helpful for you to install Google Analytics in WordPress. If you are facing any problem implementing above said methods, feel free to let me know via comment section below. I will happy to help. Also, let us know how you install Google Analytics in WordPress.
How to Insert Tables in WordPress Easily
A Complete Guide to Install and Configure W3 Total Cache WordPress Plugin
Learn How to Enable Gzip Compression in WordPress
How to Setup Yoast WordPress SEO Plugin for Best Performance
2 thoughts on “How to install Google Analytics in WordPress”
Is it must to have this plugin installed or if we include analytics code in our website will that work? I am a bit confused with this.
You can do it the way you like. I work both ways.
Thanks for stopping by!