How to Add Google Analytics to WordPress Without a Plugin?


Importance Of Google Analytics For Your WordPress Website:

Some of the major benefits of adding Google Analytics code to your WordPress website:

  1. Identify the traffic sources and the countries where the traffic comes from
  2. Understand your audience better with Google Analytics integration to WordPress website
  3. Track the web pages and blogs, and know what type of content generates a lot of traffic
  4. Track the conversions and revenue generated
  5. Improve your website user experience

Google Analytics 3

You’re only 5 steps away from adding the tracking code manually for your site.

Let’s see what is the best way to install Google Analytics on the WordPress website.

Step #1: Create a Google Account

Create a Google account if you haven’t, and set up a property.

Step #2: Log In To Google Analytics

Now sign into Google Analytics. Select your email address and log in.

Step #3: Get Your Google Analytics Tracking ID & Copy Tracking Code

After you’ve logged in into Google Analytics, go to the Admin at the bottom-left corner of your Analytics dashboard.

You can see three columns in the Admin settings. In the middle column, go to the Tracking Info and then select the Tracking code link.

You’ll be able to see the Tracking Code tab to show your property’s unique tracking ID. You will come across the complete Google Analytics tracking code.

The Tracking Code tab will open and show your property’s unique tracking ID, along with the full Google Analytics tracking code.

After getting your GA tracking code, you will need to copy the full code.

Step #4: Log In To WordPress And Add The Code

Log in the admin of your WordPress website.

Once logged in into the admin panel, go to the Appearance > Theme Editor tab in the sidebar. On this screen, you can see all of your site’s files listed on the right side, and each file’s code snippet displayed in the middle of the page.

If you’re only planning to track visitor activity on some specific pages of your website, then add code in the particular page.

But if you want to add code for the entire site, then click the header.php file along with the right-hand side. Click on it to open and the code editor will be displayed in the middle of the screen.

Find the closing </head> tag. Once you find it, paste Google Analytics tracking code just before the </head> tag. After that click on the “Update File” button to save your changes.

Step #5: Test Your Connection To Google Analytics

After adding Google Analytics code to WordPress, it takes 24 to 48 hours for new data to populate.

So while you won’t see any traffic to your site immediately, you can retest the connection that you have established.

Check by returning to the Tracking Code tab in Google Analytics. To the right of your Tracking ID is a Status Update. To confirm everything is working properly, click on Send Test Traffic. This will open your site in a small window.

If all is well, your account should update to show an active user count of 1. Wow!

If you don’t see user count immediately, be patient. Google says this can take up to a minute.

Google Analytics 4

In GA4, only 2 to 3 steps are different from GA3.

Step #1: Create A Google Account

Same as GA3.

Step #2: Log In To Google Analytics

Same as GA3.

Step #3: Get Your Google Analytics Stream ID & Copy Stream Code

After logged in into Google Analytics, Go to the Admin at the bottom-left corner of your Analytics dashboard.

You would see three columns of Admin settings. In the middle column, click on Data Streams and then click the Web.

After that Add your site URL and click on the “Create Stream” button.

After that go to the “Global site tag” tab and need to copy the full code.

Step #4: Log In To WordPress And Add The Code

Same as GA3.

Step #5: Test Your Connection To GA

After adding Google Analytics code to WordPress, it takes 24 to 48 hours for new data to populate.

So while you won’t start seeing the data on any traffic to your site immediately, you can test the connection you’ve established.

If the active user count doesn’t appear immediately, be patient. Google says this can take up to a minute.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

20 + 1 =