Google Analytics for Tech Docs

You might have heard about the build-measure-learn feedback loop, a core component of the Lean Startup πŸ¦„ methodology. Measure is important to learn how customers/audiences respond to a product or service.

But, how do you measure the performance of your tech docs? πŸ“š

In this article, I’ll share some learnings when using Google Analytics to understand visitors’ reactions to a tech docs website.

What is Google Analytics?#

First thing first, Google Analytics:

  • is a platform for tracking website performance
  • uses a simple Javascript code to gather data
  • puts a cookie in the browser to report user interactions
  • is free πŸ€—

There are tons of tutorials about Google Analytics. You can also follow the free online courses at Google Analytics Academy and earn certificates.

What can it do?#

Well, Google Analytics can do many things. For online tech docs, we are mainly interested in the following:

  • Where did the visitors come from? 🌐
  • How many visitors during a certain period? πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»
  • How much time did they spend on the pages? πŸ‘€
  • How did they interact with the individual pages? 🀸

Answers to these questions are found in the Audience reports and Behavior reports, using data collected through Pageview hits and Event hits (Transaction/Ecommerce hits usually do not apply to tech docs).

The examples below are captured using Google Merchandise Store demo account.

Audience#

The question of where did they come from is answered in the Audience -> Geo -> Location report.

location

Behavior#

When a user landed on a page, a pageview hit is sent to Google Analytics.

All Pages#

To check out which pages are the most popular and the average time a visitor spent on individual pages, we go to the Behavior -> Site Content -> All Pages report.

pageview

Content DrillDown#

But more interesting is the Behavior -> Site Content -> Content DrillDown report. Try to view it as a pie chart.

content drilldown

πŸ’‘ For a tech docs website, there are usually several top-level doc entries. Content DrillDown report can give you a clear idea about visitors’ preferences.

User Flow – Is there a common pattern?#

One question people are curious about is: can Google Analytics tell us whether the visitors follow a common pattern? πŸ—ΊοΈ For example, which page is the most common landing page, which page does a visitor usually go next?

For this purpose, we need to look at the Behavior Flow report.

Behavior flow

This information could be helpful when considering the information structure of the doc website.

Event Hits – It’s about interaction#

The biggest puzzle for any author, including a tech author, is the reaction from the audience. Do they like what they see/read, or do they hate it, or are just indifferent?

A simple trick to find it out is to place some emojis (πŸ˜€ πŸ™ πŸ˜•) on your web pages, and send an event hit when a user clicks any of them.

Have a look at DOCSY’s User Feedback widget.

The syntax for GA event hit is as below:

ga('send', 'event', eventCategory, eventAction, eventLable, eventValue)

Once you understand how GA event hit works, you can track more interactions.

For example, to send an event hit when a user clicks a button:

<button type="button" onclick="ga('send', 'event', {{ .Inner }}, {{ with .Get "href" }}{{.}}{{ end }}, window.location.pathname);">

For details, refer to Sending Data to Google Analytics.

At this point, you might get curious about what a visitor would say if they are given the opportunity. Adding a Microsoft Office Form or Google Form could be an option.

Yes, Google Analytics uses cookies. With πŸͺ there comes all the headache of privacy concerns.

If you are in a tech doc team of a company, you may want to contact the marketing department for a cookie consent management tool, and consult with your legal department for professional guidance πŸ“œ.

Reference information:

Set it Up in Hugo#

Hugo has internal templates for Google Analytics tracking.

Once the tracking code is added to the site config file, e.g., Config.toml, there is data ready for scrutinizing.

googleAnalytics = "UA-123456789-1"

More reference information:

Β© 2023-2024     New Light Docs