DEV Community

Cover image for Install Google Analytics On Your Hashnode Blog
K M H Mubin
K M H Mubin

Posted on • Originally published at mubinsodyssey.com

Install Google Analytics On Your Hashnode Blog

Do you have a blog or a static website? If the answer is yes, whether they are for personal or business use, you need Google Analytics. In this article, we're going to look at Google Analytics from the absolute beginner's perspective. Why you need it, how to get it, and how to install it on your website.

What is Google Analytics? 🤦‍♂️

Google Analytics is a free web analytics tool offered by Google to help you analyze your website traffic.

Google Analytics allows you to track and understand your customer’s behavior, user experience, online content, device functionality, and more. Google Analytics allows you the information needed to help you shape your business's success strategy, discovering things you probably never knew about visitors to your site. That's why over 50 million websites around the world use Google Analytics.

Why you need Google Analytics? 🤷

If you have a website, you should be using Google Analytics. There are no exceptions here – it’s a useful and important tool for every website owner.

Here are just a few of the many questions about your website that you can answer using Google Analytics.

  • How many people visit my website?
  • Where do my visitors from?
  • What websites send traffic to my website?
  • Which pages on my website are the most popular?
  • What marketing tactics drive the most traffics to my website?

There are many additional questions that Google Analytics can answer, but those are the most important for any website owners.

How does Google Analytics Work? 🤔

Google Analytics puts several lines of tracking code into the code of your website. The code records your users' various activities when they visit your website, along with the attributes of those users. Then it sends all the information on the Google Analytics server once the user exits your website.

Google Analytics collected data from your website in multiple ways, mainly by four levels:

User Level: related actions by each user

Session Level: each visit

Pageview Level: each page visit

Event Level: button clicks, video views, subscription, etc

How to install Google Analytics ⚙️

At first, you need a Google account for other services like Gmail, Google Drive, etc. If you don't have one, then you will need to create a new one.

⛔Don't let anyone like your web designer, web developer, web host, or SEO person create your website's Google Analytics account under their own Google account so that they can "manage" it for you. If you do, they part ways, they will take your Google Analytics data with them, and you will have to start all over.

Set up your account

Once you have a google account, you can go to Google Analytics and click the Sign into Google Analytics button. You will be greeted with the Google Analytics home page.

https://i.ibb.co/J3qvskJ/Screenshot-2020-11-04-190605.png

Fig: Homepage of Google Analytics

After you click the Sign-Up button, you will fill out information for your website. We're going to assume you have one website and only need one view.

In the account setup section, you will find an option to give your account name. You can give your website name.

https://i.ibb.co/KwdTKCG/Screenshot-2020-11-04-190650.png

Fig: Add account name

Beneath this, you will have the option to configure where your Google Analytics data can be shared.

Property setup

Here you need to add a property name. The property represents a business's data. In the reporting section, select your time zone and currency based on the country.

https://i.ibb.co/ZB0YByr/hello-mp4-snapshot-01-09-543.jpg

Fig: Add property details

Below, you can find an option named "Show advance options" and pressed it.

https://i.ibb.co/TPNvcQ7/hello-mp4-snapshot-01-50-124.jpg

Fig: Create a universal analytics property

It will give a new option to create a universal analytics property. Here, you need to add your website URL and select the second option named "Create a Universal Analytics property only." This option will give you only Universal Analytic ID's.

Add Business Information

In this section, you need to tell select the industry category for your website. For example, if your website shares information about jobs or education, select Jobs & Education. Tell me about your business size and what kind of information you are seeking.

https://i.ibb.co/rpNZKQ8/hello-mp4-snapshot-02-28-416.jpg

Fig: Add Business Information

After adding all the information the hit the create button, and it will pop-up the term and agreement page, select term and condition based on your country, and hit the next button.

https://i.ibb.co/R3tZ3Jk/hello-mp4-snapshot-03-25-747.jpg

Fig: Term and condition option

You are almost done with creating Google Analytics Account. After creating an account, it will redirect you to the Tracking Code page. If it doesn't redirect automatically, click the left setting button and then select the Tracking Info option. Here you will find your Google Analytics Tracking ID.

🚫 Never share your tracking ID with anyone.

https://i.ibb.co/w6qw7Gx/hello-mp4-snapshot-03-50-513.jpg

Fig: Copy Tracking ID

Your universal tracking ID starts with UA. Here is an example Tracking ID.

Tracking ID:
UA-54546992-1
Enter fullscreen mode Exit fullscreen mode

Copy Your tracking ID and Go to your Blog website.

Installing your tracking code 💾

Once you are finished, you need to install it on every page of your website. Here, go to your hashnode blog, then select the Dashboard. On the dashboard, you will see an option name INTEGRATION; select this option. You will find a page like this below.

https://i.ibb.co/VgyGM0d/hello-mp4-snapshot-04-25-693.jpg

Fig: Adding Google Analytics Tracking ID

You will see a dedicated option to enter your tracking ID. Simple paste your tracking ID and save the change. It will automatically add this tracking ID to all webpages. Also, it will start tracking your information.

Congratulation! 🎉🎊 You have successfully set up Google Analytics on your blog.

Facing Problem or other info 😲

If you face any problem or want to ask questions or suggestions, you can join the Hashnode Exclusive Discord server and chat with them.


🚩👉 If it was useful to you, please Like/Share to reach others as well. Please hit the Subscribe button at the top of the page to get an email notification on my latest posts.

I talk about web development and UI design on Twitter @kmhmubin, come to talk with me there!

The cover image is an improvisation on top of the work from Canva.

Top comments (3)

Collapse
 
vanduc1102 profile image
Duc Nguyen • Edited

Seems G-xxxxxxxx works same way with UA-xxxxxx

In web-only properties, this is referred to as Tracking ID in format UA-XXXXXXXX-X

Collapse
 
mcsee profile image
Maxi Contieri

Hi

This is for the universal analytics code.

Nowadays google gives new identifiers with this form G-XXXXXXXXX#

how can we setup this code ?

Collapse
 
kmhmubin profile image
K M H Mubin

As for I know, hashnode doesn't have any option to add G-xxx like U-xx code. But you can add G-xx code in the traditional way. Copy and paste the script on the meta tags area.