0

I have been looking into using Google Analytics for a private intranet application which does not have any public URL; e.g., the application might be running in http://myapplication or http://192.124.51.12.

Officially, this wouldn't be supported by Google Analytics:

Your intranet must also be accessible through a fully qualified domain name such as http://intranet.example.com. The Analytics JavaScript won't work if your intranet can only be accessed using a domain name that isn't fully qualified, such as http://intranet.

Before knowing this, I set up a GA account with a bogus domain name and started testing a local application in http://localhost, http://testdomain and http://testdomain.com. In spite of what the documentation actually says, this seems to work flawlessly and GA is picking up all hits and showing all the reports correctly.

Therefore, my questions would be:

  • What is the domain name set in my GA account actually used for? It certainly doesn't seem like GA is checking that I am in said domain before actually sending and logging hits.
  • Is this an actually viable solution? "Seems to work" is not a particularly strong argument, so I would like to know if people have been using GA to work with private intranets, and if there are any changes or hacks that need to be made.
unpollito
  • 937
  • 1
  • 11
  • 30

1 Answers1

2

What is the domain name set in my GA account actually used for?
Technically nothing. You can setup a cross domain tracker and have it worked on as many domains as you want which will have nothing to do with the value set in GA Admin

Is this an actually viable solution?
Yes. I've rolled it out at some large corporate intranet already. Things to bear in mind:

  • Analytics library: people sitting within your company network must be able to load the analytics library (analytics.js)

  • PII (Personally Identifiable Information): one of the often used functionality of the intranet being to look people up, be careful if you enable search tracking as you might find yourself collecting PII information (names, emails), which is against GA's terms and conditions. There are some workarounds available (eg don't track if search containers @, or obfuscate part of email etc...)

FQDNs
Indeed by default it won't work. The solution is to either use an IP address or turn off domain hashing. Note: if you own a private network and intranet, setting up an FQDN that people can resolve shouldn't be too difficult (eg on the internet router).

Max
  • 12,794
  • 30
  • 90
  • 142
  • Thank you very much for the super fast reply, Max. However, there's something I don't quite understand. If "http://testdomain:8000" worked for me, how is it that GA wouldn't work without a FQDN? Should I set "cookieDomain" to "none" just to cover my back? – unpollito Mar 12 '18 at 11:58
  • 1
    @unpollito, you'd need to set "storage" to "none" (not cookiedomain), and it that case you'd need to persist your own clientid and pass it to GA, else each hit will start a new session. – Eike Pierstorff Mar 12 '18 at 12:29