Track Your Readership: Integrating Google Analytics into Your NetHelp

If you’ve ever wondered – or flat-out need to know – which topics are the most popular ones in your Help, there is a way to gather these stats using NetHelp 2.0 and  Google Analytics.

  1. To start out, set up a Google Analytics account. Start by signing in, then work through the steps.
  2. Once you have an account, open Doc-To-Help and create a custom NetHelp 2.0 Theme. See Adding a NetHelp 2.0 Theme for instructions. Your custom Theme will be stored  in the \\My Doc-To-Help Projects\Doc-To-Help\Themes\NetHelp 2.0\Themes\Name of Theme folder.
  3. Download the zip file included with this post and drop it into the Theme’s folder. Unzip it.
  4. Open the layout.html file (located in the same Theme folder) and add <script src=“”></script> at the end of the head section.
  5. Add your Google Analytics script after the jquery script. (See the example below.) Make sure to replace the placeholder ‘UA-5551212-1′ with your Google Analytics tracking code.
  6. Rebuild the NetHelp 2.0 Target.

Here is what the beginning of the layout.html file will now look like (new items are pink):

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<link rel="stylesheet" type="text/css" media="all" href="theme.css" />
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
<link rel="stylesheet" type="text/css" media="screen" href="splitter.css" />
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
<link rel="stylesheet" type="text/css" media="all" href="topic.css" />
<link rel="stylesheet" type="text/css" media="all" href="custom-icons.css" />
<link rel="stylesheet" type="text/css" media="all" href="user.css" />
<script type="text/javascript" src="theme.js"></script>
<script type="text/javascript" src="splitter.js"></script>
<script type="text/javascript" src="search-addons.js"></script>
<script src=""></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5551212-1']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

For more on customizing a NetHelp 2.0 Theme, see Using the Theme Editor.

Download the script here:

Now you can analyze away :-)

Bonus Google goodness: if you would like to add Google Search to your NetHelp, see Integrating Google Custom Search into Your NetHelp Outputs.

This entry was posted in Doc-To-Help and tagged , , on by .

About Nicky Bleiel

I am the Lead Information Developer for Doc-To-Help and a Doc-To-Help trainer. I have 19 years of experience in technical communication; writing and designing information for software products in the documentation, media, industrial automation, simulation, and pharmaceutical industries. I am the President of the Society for Technical Communication and have presented talks at the STC Summit, WritersUA, tcworld, CIDM (Content Management Strategies/DITA North America), and LavaCon on many topics, including embedded help, tools and technologies, user assistance design, single sourcing, wikis, social media, agile, and convergence technical communication. I have been published in STC's Intercom, Tieline, STC conference proceedings, tcworld magazine, TechCom Manager Newsletter, and the WritersUA and the Content Wrangler websites. Additionally, I teach Technical Writing at the Community College of Allegheny County.

13 thoughts on “Track Your Readership: Integrating Google Analytics into Your NetHelp

  1. Brad Keller

    Here’s the official solution for what to do when Google Analytics is only tracking pageviews for the default.htm page:

    1. Go to your Google Analytics properties and set the “Enhanced link
    attribution” property.

    2. Replace the code in the layout.html file we provided in the blog post
    with the new code (after adding your account ID).

    3. Build and post. It sometimes takes 24 hours for analytics results to

    The file that was attached to the blog post is still

  2. chethertz

    Hi Nicky,
    Hey this looks neat; tracking my NetHelp’s usage with Google Analytics is something I want to do. But am I correct that these instructions seem no longer applicable to v2012 builds which include the revised (circa 3q12) theme builder? Unless I’m misunderstanding the way the custom themes are implemented, isn’t the layout.html file superseded by the settings.en-us.xml file? It’s the settings.en-us.xml file that changes as I change theme settings with the theme wizard…
    Thanks if you can help to clarify.

    1. chethertz

      …Or is it that the layout.html is applicable AND the settings.en-us.xml is applicable — and I can still use your GA instructions from the blog post AND the theme customizations in my settings.en-us.xml file?
      Thanks. –Chet

    2. Nicky Bleiel Post author

      Hi Chet –
      Thanks for your questions. Yes, this is still the correct method for gathering stats with Google Analytics. And, depending on what you want to do, you can edit both the layout.html file and the settings.en-us.xml file.

      Hope this helps!


      1. chethertz

        Great, thanks. I did perform the procedure today as detailed in the blog post, and it SHOULD be in place… But for some reason GA admin status still indicates “tracking not installed.” I troubleshooted it through some of their help files but no joy. I did see one article that said I need to give it at least 24 hours — is that your experience? I’ll check again in a day I guess.

          1. chethertz

            Yep, waiting a day did the trick as far as data collection goes — test site now sending data to GA and I am beginning to see numbers accordingly. Thanks! But what ended up being the solution (offline of this blog response area) to the issue noted by user Jonathan who was getting numbers for landing page only? That seems to be what’s happening for me too. GA doesn’t seem to know about hits to pages other than my /help/default.htm. Is there something that you know of that I need to configure differently in D2H? Or do you think it’s a matter of tweaking my GA config (and if so do you happen to know how)?
            THANKS. –Chet

  3. Jonathan

    This allows me to track the number of people who visit the default landing page to the help file, but it doesn’t track any further pages, so I can’t tell which are the most read sections of the help file. Any ideas?

      1. Hong He

        Hi Nicky,

        I am currently working on web site and use the Doc-To-Help, now it seems that only default landing help page can be tracked, but it doesn’t track any further pages, just want to know how all the pages can be tracked ?

        Thanks so much in advance.


Leave a Reply