logo

Google Analytics on Secured Domino Websites

The other day I got asked:

This might seem like a silly question, but can we use google analytics on a private (login access only) site? The way I've seen it work so far is only on public facing sites.

Not a silly question at all. Well, maybe it is, but I didn't know the answer either. In reply I said that I couldn't see any reason why not and that I'd take a look.

From the way I understood it to work you just need to load the external Google-hosted JavaScript file in to your page and that's all it takes. Although there is one step in the sign-up process which limits where you can use Analytics. Before Google will start tracking a site it takes a look at the site in question to make sure you've added your unique tracking code to the bottom of the page found at the domain you want to track. For this reason the site must be Internet-facing.

If you want to track hits to a site not available on the Intranet using the Analytics code this answer from the Google site might help:

If you have content behind a security firewall or on an intranet or internal network that prevents you from using the Google Analytics service, Urchin 5 software is for you.

Now, assuming the site is accessible from the Internet, what happens if you require a login to access the site? Well, Google will only ever see the login form, so you just need to make sure your tracking code is on the bottom of the login form. When Google "pings" the site you're trying to setup to see if it can find the tracking code it gets a login form. This doesn't matter though. As long as the code is in the HTML returned.

To test the theory I tried if on a site of my own. If you look at clients.rockalldesign.com you'll see a login page for my home-made CRM package. Look at the bottom of the source and you'll see the Google tracking code. It all works as expected and I can now see how much use the CRM is getting -- even though Google itself can't get past the login form and/or see any of the actual content beyond it.

If you host lots of sites and want to track them in different Anayltics accounts then you'll need to either use multiple custom Login forms or have the code which displays at the bottom of the login form compute itself based on the Server_Name field and the site being accessed when the login form appears.

Hope that helps.

Comments

  1. I`ve been using Analytics not only on login form and it works fine. The only problem I have is that i didn`t figure out how to consolidate information. All the stuff that comes after the ?openform& separates the results (as if it were different pages) when it shouldn`t.

  2. We've been using Google Analytics on every page of our new site, which requires everyone to login, and it works great! Being able to generate reports based on the Window Title and/or the URL has been really powerful to highlight the hotspots.

    • avatar
    • Paul
    • Wed 6 Aug 2008 01:31 AM

    I haven't found out yet how to preform analytics based on usernames.

    In an older log-reporting tools we used different usergroups in notes to generate reports to see which web-applications/part of our intranet are used the most by people with role X or people with Role Y.

  3. Tracking by username is quite easy to implement. Just add the following code to the end of your GA script block. The <Computed Value> below is your username formula (@username or equivalent).

    pageTracker._setVar("<Computed Value>");

    To parse the results by username, assuming you allowed a day for the new code to report to their servers, just select "User Defined Value" from the SEGMENT field combobox within any specific report.

  4. when you set pageTracker._setVar("<Computed Value>");

    make sure the user has already authenticated...

    you are only allowed one variable per user per session.. so if you add this on your login page (before they authenticate) every user will track as Anonymous

    you can also choose not to track the normal page statistics and only capture spoofed urls... some computed value like

    pageTracker._trackPageview('/userlog/BhaidayaBaker/DatabaseName/DocumentTitle/08-08-2008');

    or

    to track all user activity by date

    pageTracker._trackPageview('/userlog/BhaidayaBaker/08-08-2008/DatabaseName/DocumentTitle/');

    etc... keep in mind if you are tracking both.. then you'll be receiving twice as many page views...

  5. Hi Jake,

    I have added the code to the wiki form and login form and we are getting statistics. However, we don't get statistics on individual pages visited within the wiki. We seem to get a large number visiting "/" which I assumed waws the initial login screen. I have checked that the javascript appears on all the wiki pages when loaded.

    Any idea why we can't get statistics on wiki pages?

    Thanks

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 5 Aug 2008

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content