{empowering business}
Getting In-Page Analytics Working with Drupal Google Analytics Module
It's amazing how much time we need to spend tweaking all our development tools to keep them all playing together nicely. So when I find a problem that takes me a while to fix, I like to post it here in the hope that it will save someone else some time.
Such was the case today when I switched over to the latest version of Google Analytics. In-Page Analytics, one of my favorite tools in GA, stopped working on all my Drupal sites.
Here's the error message I got:
Problem loading In-Page Analytics
We've identified problems in your setup. These may cause problems loading In-Page Analytics.
Your site doesn't load ga.js from Google. If you host the Google tracking code on your own servers, it isn't updated automatically and can miss important changes.
Unfortunately, this error message is misleading... Drupal's Google Analytics module does indeed load ga.js from Google. But there are a few Drupal / browser / Analytics settings that might prevent them from working together happily.
You'll need to check the following settings:
- Domain settings in Google analytics and .htaccess,
- Role specific traffic settings in your Drupal module, and
- Tracking settings in your browser.
Domain and Redirect Settings
First, make sure that your domain settings match on GA and your web site. For example, if you set up your GA account to track www.example.com, make sure you're not redirecting your users from www.example.com to example.com (typically done in .htaccess). When you view In-Page Analytics, Google loads your home page in an <iframe>. If GA tries to load www.example.com and is redirected to a different hostname, it will throw an error.
Role Specific Traffic Setting
For most of my Drupal sites, I like to track only anonymous users:

This helps me filter out traffic caused by the site administrators (editors, publishers, etc). This is a personal preference, and it really depends on the nature of the site. Most sites I work with do not allow the general public to register. If you do choose to track only anonymous users, you'll need to make sure you're logged out of Drupal when you use Analytics. If you're logged in, Drupal will not include the GA JavaScript.
Tracking Settings in Your Browser
Lastliy, some browsers now offer you the ability to control whether some web sites track you. Here is what the setting looks like in Firefox:
![]()
According to Mozilla, this setting is not set by default. (In other words, the default setting is to allow tracking.) But at some point, I turned this setting on and disallowed tracking. Unfortunately, when you turn this option on, it conflicts with the default settings for the GA module in Drupal:
![]()
Whether you set Drupal to opt-out of tracking is up to you. But if you do allow it in Drupal, and you choose to opt out in the browser you're using to access GA, it will break it.
So if you enable the privacy setting in Firefox, you must disable the web tracking opt-out privacy setting in Drupal's GA module:
![]()
The Bottom Line
I'm guessing there are other settings that might cause issues. The bottom line is that Google's In-Page Analytics needs to load your site in a <iframe> within GA. If there's anything in your settings that prevents the ga.js file from loading, it's going to break In-Page Analytics.



Comments
Thank you so much
Your article has just helped me fix an issue with in-page analytics on my website - it was the www. non-www. issue you mentioned. Thanks so much for sharing!
Thanks Mark. It is helpful
Thanks Mark. It is helpful article.