How to add Google Analytics to WordPress without a plugin?


First of all, we need to understand what is analytics? Analytics is nothing much turning raw data into information which can ultimately help in taking descisions.
For Example: we are ask to speak on a topic. First we would collect all the relevant data which we would speak, then process same data into meaningful sentencess and sequences. This will help to make audience about the context of the topic. But if there is no sequence, then noone would understand. Analytics has sub term analysis, which is a process of analysising and compiling data into meaniful form to make descisions.

Analytics is used at various places, like Customer insight, healthcare, science & research, business insight, traffic control, ecommerce solutions, finance, sports performance, risk management, security management, internet web search and the list goes on.

Some of the popular Analytics tools

  1. SAS
  2. Apache Spark
  3. Splunk
  4. R Programming
  5. Excel
  6. Tableau
  7. Python
  8. RapidMiner
  9. KNIME
  10. QlikView

What is google Analytics?
Analytics offered by google is google analytics. This servie was launched in 2005. This is service is freely availble through google. This is basically used to track traffic visiting to our website. It helps in determining traffic with

  1. Type of user
  2. Country
  3. Operating system
  4. Web or app
  5. session duration
  6. Bouce Rate

Since google analytics service is freely available, so this is most commonly used for tracking website traffic in the world. Now let us learn, how to generate/add google analytics code in our website

Step 1: Login to Google analytics

Step 2: Click on Admin/gear icon that is used for the Admin section

Step 3: Select the property (website) that you wish to track by clicking on the drop-down menu under the property section.

Step 4: Under the column you will see an option labeled Tracking Info. Click on Tracking Info.

Step 5: This will bring up another set of options. Click on the one labeled Tracking Code.

Step 6: Copy this text in (gtag.js) and then go to your WordPress site.

Apply the Google Tracking Code into the WordPress theme’s header
Step 1: Log into the WordPress Administrator

Step 2: Click on Appearance and then click on Theme Editor.

Step 3: Click on theme header(header.php) at left side

Step 4: add google analytics code inside head tag

Step 5: click on update file

Daily Gyan
I am IT professional with more than 9 years of experience. I would try my best to share my experience and knowledge through this Blog. I am also an national level Table Tennis Player