link

How To Add Google Analytics To WordPress Without Plugin – 2020

Starting with a new website & saying “Hello World” (hesitantly) to the WordPress back-end can be overwhelming at first.

BUT! its not what it looks like.

Adding Google Analytics to WordPress is super easy. Follow along & you’re good to go.

This article will take to the ride from Introduction to Google Analytics, How to add Google Analytics to WordPress & finally to Tips to Optimize Google Analytics for your dear site.

Table of Content

1. Quick Introduction to Google Analytics
2. How to add Google Analytics to WordPress
3. 7 Tips to optimize Google Analytics
3.1. Exclude Bots Traffic from Google Analytics
3.2. Exclude Internal Traffic From Google Analytics
3.3. Adding Site Search in Google Analytics
3.4. Connecting Google Search Console & Google Analytics
3.5. UTM Tags to better understand your Data
3.6. How to add Annotations in Google Analytics
3.7. How to Create Custom Alerts

Quick Introduction to Google Analytics

To put it simply, it is a place where a website meets analytics. It’ll answer all your questions on major performance parameters, such as:

  • Who comes to your site (anonymous data) [Audience Report]
  • Where they come from [Acquisition Report]
  • How they interacted with your site stuff [Behavior Report]
  • Most importantly, are they converting? [Conversions Report]

How does it collect all this data is still a question. It all begins with a piece of JavaScript Code we add at the WordPress back-end. The moment one clicks on a website with configured google analytics, JavaScript tracking code performs two tasks:

  • Assign that user an anonymous ID called Cookie to identify users during its future visits.
  • Send user’s information in google analytics, such as device, screen resolution, source, etc., which we use to interpret information.
How google analytics collects data

Just like report cards, it tells a lot.

Since the javascript is triggered when the page loads, Google Analytics only tracks page views by default.

Event Tracking such as video play, social sharing hits, etc. can be configured manually or by using Google Tag Manager.

How to Add Google Analytics to WordPress

How to Add Google Analytics To WordPress

Step 1: Sign in to Google Analytics using an existing Gmail ID. If you wish to create a separate Gmail account for Google Analytics, click here to create one.

Step 2: Click on “Start Measuring. “Fill in “Account Name” in the Account Detail section. It is essentially the name of your business. Tick all the Account Data Sharing Settings & then click on Next.

Step 3: Select the type of digital asset you want to measure. In our case, it is the website. Then click on “Next.”

Step 4: Under the Property Details, type in the Website Name you wish to track & add website URL. Select “https://” under website URL if your website has an attached SSL certificate. Select a suitable industry & reporting time zone, and click on Create Button.

Step 5: Choose your country from the drop-down, check both conditions & click on “I Accept.” It’ll take you to Traffic Code Screen in the admin section.

Step 6: Copy the JavaScript Tag starting from “<!– Google Site Tag(gtag.js) – Google Analytics–>.” This code has to be there in the head tag of every page.

Step 7: Log In to your WordPress Account. Head over to “Theme Editor” under the “Appearance” section on the left.

Step 8: Select the “header.php” from theme files on the Right. Search for closing head tag i.e. “</head>” & paste the javascript tag right above it, and click on “Update File.”

Step 9: Phew! it’s done. Go to your website & check the realtime reports in Google Analytics. You’ll see a real-time user, which is proof that google analytics is linked to your site successfully.

How to add Google Analytics to WordPress using Google Tag Manager

Step 1: Follow the first five steps as given in “How to add Google Analytics to WordPress

Step 2: Log in to Google Tag Manager using the same Gmail ID.

Step 3: Click on “Create Account” in Blue Box. Fill in your Company name & country under the Account Setup.

Step 4: Type in your website URL & select target platform, i.e. Web & then click on Create. Tick the “I accept terms” at the bottom & click on “Yes” at the top right corner. It’ll take you the “Install Google Tag Manager” window with two codes.

Step 5: Head over to WordPress “Theme Editor” under the Appearance section on the left.

Step 6: Select the “header.php” from theme files on the Right. Search for closing head tag i.e. “</head>” & paste the first tag right above it and the second tag right below the open body tag i.e. <body>. Now click on “Update File” at the bottom.

Step 7: Head over to google tag manager & click on “Tags” in the left section.

Step 8: Click on the “New” button. Give your tag a name such as Google Analytics Configuration.

Step 9: Click on Tag Configuration & Select “Google Analytics: Universal Analytics”. Keep the “Track Type” as Page View & choose “New Variable” under Google Analytics Settings.

Step 10: Enter your “Tracking ID” in the form of “UA-XXXXXXXXX-X.” You can find this in Google Analytics mentioned inside Tracking Info in the “Admin Section”.

Step 11: Leave the cookie domain at Auto. Name the variable as your “Tracking ID” to avoid confusion and then click on the “Save” button.

Step 12: Click on Triggering & select “All Page”. It means you want to deploy tracking code on every page of your website. Click on Save.

Step 13: Now verify under the Real-time Reports whether you’re receiving hits. After verification, click on the blue “submit” button at the top right corner.

Step 14: And your google analytics is now all set to collect data & report it back to you!

7 Tips To Optimize Google Analytics

Table of Content
1. Exclude Bots Traffic from Google Analytics
2. Exclude Internal Traffic From Google Analytics
3. Adding Site Search in Google Analytics
4. Connecting Google Search Console & Google Analytics
5. UTM Tags to better understand your Data
6. How to add Annotations in Google Analytics
7. How to Create Custom Alerts

1. Spiders! Yikes. We Don’t want to track them.

Traffic coming from crawlers & spiders is useless & hence we don’t want to skew our data with bots traffic. And excluding bots traffic is really simple. Follow along!

Step 1: Click on the Gear Icon or admin section at the bottom left corner.

Step 2: Head over to the “View Settings” under View in the third column.

Step 3: Find the “Bot Filtering” section & check the box next to “Exclude all traffic from known bots & spiders.”

Step 4: Scroll down & click “done”

exclude bots traffic in google analytics

2. Time To Exclude Yourself From Traffic.

I used to visit my blog a lot to check how can I improve your experience in every way possible. A few days in & I realized what about my visits to the website. And then I resorted to filters. Filters are a boon in the analytics world. All you need to do is:

Step 1: Click on the Gear Icon or admin section at the bottom left corner.

Step 2: In the third column, select among different “Views” for which you want to filter out internal data.

Note: you can have separate “Views” for different purposes [eg. you may want to track different targeted countries separately.]

Step 3: Click on “Filters” under the View in the third column.

Step 4: Click on the bright red “Add Filters” button.

Step 5: Keep the “Choose method to apply filter to view” as it is.

Step 6: Give your filter a name. [eg., Exclude Office Traffic]

Step 7: Under the filter type, you’ll find three dropdowns: 

  1. Select “exclude” under “filter type”
  2. Select “traffic from the IP address” under “select source”
  3. Select “that are equal to” under “select expression”

Step 8: Search on Google “my IP address” & type that in. And then click on “save.”

How to find your Ip address

Note: The data already collected before excluding internal traffic will remain the same.

How to exclude internal Traffic

3. I wonder what do people search on my site. Let’s find out!

Site search is one of the best ways to know what does your visitors expect from your content. That is where you can start creating content & connect with your audience.

Note: To configure site search, make sure you have a site search option present on the website.

Step 1: Click on the Gear Icon or admin section at the bottom left corner.

Step 2: Head over to the “View Settings” under View in the third column.

Step 3: Scroll down to find “site search settings” & switch the toggle to On.

Step 4: In the query parameter field, enter the word that designates the search query parameter.

To know the query parameter, type something in the search bar of your site. Now, look at the URL “https:www.optimizingkitty.com/?s=google+analytics.” In my case, The alphabet “s” after the question mark is the query parameter for my site. Sometimes, a query parameter can be designated by “search”, “term”, “q”, etc. as well. Finally, add your query parameter to the next field.

How to identify search query parameter

Step 5: Next, you’ll find a checkbox saying: strip query parameter out of the URL. Google Analytics tracks the same URL with query parameters differently. What I mean by this is that google analytics records metrics for “optimizingkitty.com”, “optimizingkitty.com?s=web+analytics” and “optimizingkitty.com?s=google+analytics” separately. Checking this box will treat URLs the same. Whether you should check it or not depends on how big your site is. If your site is big, you may check it to keep your data concise.

Step 6: Click on the blue save button & you’re set to analyze your site search data.

how to add site search settings in google analytics

You can locate this report under Behaviour –> Site Search –> Search Terms

4. Marrying Google Search Console & Google Analytics

Google Search Console is a door that can open many analytics avenues if it is linked with your google analytics account. Linking both can get your hands on the report about your website’s performance in search engine results. To link the accounts, you must have a Google Search Console account already in place.

Step 1: Click on the Gear Icon or admin section at the bottom left corner.

Step 2: Click on “All Products” under Property column in the middle.

Step 3: Scroll & click on “Link Search Console.”

Step 4: Click on “Add” & check the circle next to the site you wish to link.

Step 5: Click on “Save” & your accounts are successfully linked.

You can locate these reports in Google Analytics: Acquisition –> Search Console –> Queries.

5. Don’t you forget UTM Tags

Do you want to measure the success of your Facebook campaign or the last email you sent to your beloved audience? UTM Tags can be your BFF in that case. It attaches extra information about the campaign, source, medium, etc. to the URL. This extra information gets stored in google analytics that can be used to measure the success of your campaigns.

A link with UTM tags look something like this: optimizingkitty.com/how-to-link-google-analytics-&-wordpress/?utm_source=twitter&utm_medium=image&utm_campaign=web_analytics_series

To add such parameters to your URL, click on this link.

Step 1: Add your website URL in the website URL field.

Step 2: In the campaign source field, add the platform from where the traffic originates.

Step 3: In the campaign medium field, add the medium of your content such as “Instagram_story” or “facebook_video”

Step 4: In the campaign name field, assign a suitable name to your campaign. such as “diwali_offer”

how to add UTM tags to link

Step 5: Campaign term is generally for search ads. You can add the targeted keywords here.

Step 6: Campaign content can be used for A/B testing. let’s say for instance you have to different pieces of content, you can this field to create different links pointing at the same URL.

Step 7: It will create a customized link with the information you entered. Now, just place this link instead of the traditional link.

link with utm tags

Note: UTM Tags are case sensitive, so be consistent with the format while tagging your link.

You can locate this report under Acquisition –> Campaigns –> All Campaigns

6. Always better with Annotations

Do you use quick notes? Those are always there to make our life easier. Annotations are like quick notes on Google Analytics. It’ll make your graphs even more informative. It means to add notes directly into the graphs so that your data come out stronger and better.

You’ll be like, how can notes help in this case? Let’s say I do some change on my site in the backend, unaware of how it can affect the traffic on my site. You can attach it to a particular date on which the change was made, and you’ll see your data will start speaking. Let’s configure it.

Step 1: Click on the tiny arrow right below any timeline graph.

Step 2: Click on “Create new annotation” in the extreme left.

Step 3: Select the date of the changes made & give that annotation a name. eg: Increase Email Budget, or WordPress theme change.

Step 4: Select suitable visibility & click on save.

how to add annotations in google analytics

7. How to Create Custom Alerts

Alerts are another way of talking to your data. It kind of benchmarks your success, & the moment you achieve that benchmark, it’ll alert you. Let’s say you’re working really hard with your twitter campaigns, but when will your hard work pay off is uncertain. Keeping a track of everything you’re working on can be a burden. To keep that burden off your shoulder, you can set up alerts, which is like an autopilot. Let’s set up alerts to keep the burden at bay.

Step 1: Click on the Gear Icon or admin section at the bottom left corner.

Step 2: In the third column, click on “custom alerts” under the View in the third column. (scroll down to find it)

Step 3: Assign a Name & Choose the view you wish to create the alert for.

Step 4: Select the period & email you want the alert triggers in.

Step 5: Set the Alert Conditions:

  1. Choose any dimension you wish to track from the drop-down under “This applies to.”
  2. Select the metric that is part of your condition from the drop-down “Alert me when.”
  3. Choose the condition & value to benchmark your metric.

Your alert is all set. Keep your eyes on watch & wait for the trigger to hit your inbox anytime soon.

How to Create Custom Alerts

You Made It!

Thanks for making it till here. Hope this guide accelerates your experience to work with Google Analytics 🙂

In the end, I want to say that If you utilize your data correctly, it’ll always back your opinions. It’ll start talking! Make the best out of it.

Go ahead & play around in the comment section to share your recommendations for Google Analytics beginners.

Leave a Message

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