Our Articles about the Web and Drupal

moduleTips: Auto Assign Role for better Google Analytics results

Just about every webmaster has seen what Google Analytics can do. Its a very flexible and powerful system to track what visitors are doing on your sites. Many people don't realize though that you can easily track user segments also. If you have a large number of users who create their own accounts, then one module which can really help with this is the Auto Assign Role module.

Google Analytics (lets call it GA from now on) has the ability to track a user defined variable. The GA module can put user roles or profile fields into this variable. Drupal out of the box will only give new users the "authenticated user" tole by default. But using the Auto Assign Role module you can automatically give these public users a specific role that can then be tracked.

Then in the GA interface, you can define the user segments based on these variables. There are some good screencasts available about this already. Note that the GA module doesn't output the user variable for anonymous users, so to make an anonymous segment you have to make a condition like "does not match" for each of your roles.

Another trick is to use Auto Assign Role to give a special role to different types of users based on a registration form. For example you might have a sports site and you want to collect different information and separately track players and coaches on your site. Using two different registration forms, Auto Assign Role can give users the role they should have, making an easy way for you to track user segments with little or no custom code.

Share this

Let's start talking about your project!

Let's start talking about your project!