Google analytics module lets you select what user roles to track, however, it is likely that you will want both anonymous and authenticated users to be tracked. If you select authenticated users, it means that any account on your website will have this role, which means, in reality, that every single role will be tracked regardless of whether you have specifically selected that role to be tracked.
This is explained in the following article on drupal.org, you will need a bit of PHP knowledge to follow this up: Roles opt-out AND path filter functionality: a snippet. Follow that link up to check on the complete snippet to be used.
In particular, the specific parts of the codes that needs touching are:
// These are the roles that should not get the Google Analytics // tracker code on pages they visit. Replace 'staff' etc. with // your own roles you want to exclude. $hide_roles = array( 'administrative user', 'staff', 'webmaster', 'editor' );
On this one, you need to change the roles to the ones you want to be NOT tracked.
Remember that to avoid the administrator user (uid = 1) not to be tracked, you need to assign one of the skipped out roles to that user.
The following part is also important and is the one that you need to edit to filter specific paths from being tracked. Because we are using the visibility field to do that, we need to manually add those to the PHP snippet.
// Page specific tracking settings: // 0 = Add to every page except the listed pages (default). // 1 = Add to the listed pages only. $visibility = 0; // Inclusion/exclusion list of pages. $paths = array( 'admin', 'admin/*', 'user/*/*', 'node/add*', 'node/*/*' );
Basically, each element of the array is a line that you would have put on the visibility settings.
You have to change the visibility variable to set the path filter either to be inclusive of those pages or exclusive.
Comments on the code explain this as well.