2

I'm trying to set up Google Analytics on an intranet site that is not publicly accessible.

I read the help page that states you have to use a FQDN name, so I tried using http://site.domain.local but it complains that the "URL ends with an invalid top-level domain name".

I can find examples on Google of people successfully using .local in the past, but those were mostly from posts a few years back (like this one). Is this still possible or is there another way to track a website without a public URL?

1
  • 1
    I assume you get the error in the property settings. My advice would be to use site.domain.com (ignoring the fact that the domain does not exist). GA will still track, about the only place where the setting is relevant is in-page analyses and the little arrow thingies in the page url reports that allow you to open an url in a popup windows. Just make sure GA can pull the analytics.js file, send data to the GA server and set cookies. Commented May 22, 2015 at 13:33

2 Answers 2

1

The way you have it setup right now will not work. Google Analytics JS code will not send the tracking hit (__utm.gif) to the GA servers.

There are a few options you might want to try:

  1. Use an IP address instead of .local

  2. Turn off domain hashing by setting _setDomainName("none")

The following is from Google Analytics help:

In order for Google Analytics to generate reports for your corporate intranet usage, your corporate network must be able to reach the Google Analytics JavaScript file (analytics.js). Try loading the file in your browser using one of the following links:

http://www.google-analytics.com/analytics.js https://www.google-analytics.com/analytics.js

If you can reach one of these URLs from your internal network, you can use Google Analytics to collect data from your intranet. Your intranet must also be accessible through a fully qualified domain name such as http://intranet.example.com. The Google 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.

If all fails, consider using Piwik Analytics instead of Google Analytics.

1
  • 1
    Just to avoid confustion, if Brandon is setting up a GA account now then he will be using Universal Analytics, so there will be no utm.gif and no setDomainName function etc. (the quoted paragraph from the help is still relevant to UA). Commented May 22, 2015 at 13:26
0

With Universal Analytics and earlier, you need to use the setDomainName method in the tracking code to assign a value of none:

_setDomainName("none")

With GA4, the URL of the Data Stream appears to be more of a label than a configuration setting.

That said, Google Analytics is not a good web analytics solution for corporate Intranets. There are a few reasons for this:

Data Ownership
No PII
Legalese & Govt Regulations (GDPR, CCPA, etc.)
Data Sampling
Tracking is easily blocked

Self-hosted solutions are better for Intranet environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.