Artificial Intelligence

What I Learned Today: Check Your Default Google Analytics Settings

Google Analytics Module Settings


Filed under:

Google Analytics Module Settings

Drupal's Google Analytics Module is great. There are a few settings though that I recently found out you'll want to pay closer attention to. First is the "Pages" section of the configuration form, which allows you to only include/exclude Google Analytics tracking code on certain pages. The default settings are to exclude the code on the following pages.

admin
admin/*
batch
node/add*
node/*/*
user/*/*

The other setting to keep in mind is in the "Privacy" section of the configuration form. In particular the "Universal web tracking opt-out" setting which is enabled by default. Those are pretty good defaults for most sites, but if you aren't aware of them, they can also cause you to lose some valuable analytics data.

The "Universal web tracking opt-out" setting allows users to setup their browsers to send a Do Not Track header. The Google Analytics module respects this header if the "Universal web tracking opt-out" setting is enabled. That is unless page caching is enabled. If the page is cached, then Google Analytics is always included in the cached page. So on production sites, this usually means that tracking is enabled except if a user is logged in and they setup their browser to send the Do Not Track header. Again, this seems like the reasonable and respectful default.

Introduce Custom Panel Pages Into the Mix

Now consider you have a Custom Panel page with the url: "node/%/my-sub-page", which is a special sub page for a particular content type on your site. The contents of the panel page doesn't matter much, what matters is that if you are using the default Google Analytics settings for googleanalytics_pages, this page will not have Google Analytics tracking on it. The fix is fairly simple, update your Google Analytics settings and replace "node/*/*" with node/*/edit, and maybe a few others that you might not care about (ie: node/*/devel, node/*/nodequeue if you use those modules).

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.