Does version 6.x-2.x of this module still require the php code described in the Google Analytics handbook at http://drupal.org/node/261997 in order to exclude specific roles from tracking?

Izzy

Comments

hass’s picture

Status: Active » Fixed

Docs are up to date. Not sure what you'd like to do. The docs PHP code is only for one special case.

izmeez’s picture

We want to exclude the site admin who is also an authenticated user.

As the documentation says, unchecking admin on the "Add tracking for special roles" will not be sufficient. It requires the sample php, which is very simple.

Is this understanding correct? Thanks,

Izzy

hass’s picture

You are able to exclude users via it's personal user setting from tracking. Setup GA with "Track users by default, but let individual users to opt out." and than go to user/1/edit and uncheck the GA tracking. If you need this for other users you need to assign the appropriate permission. That's all.

hass’s picture

Title: Google_analytics, Exclude tracking by role » Exclude admin from tracking
izmeez’s picture

Thank you. Yes, I noticed it could be done on an individual basis the way you suggest but to exclude by role and not grant individual permissions, the php sample is required. Correct?

Another way that comes to mind is to provide a segment in the module administration screens that instead of "add to tracking" was "exclude from tracking", but I think the current way with the php is good, it is documented and users of this module, like me, need to take notice.

Thanks,

Izzy

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nodecode’s picture

Status: Closed (fixed) » Active

So could someone tell me where exactly I would put the PHP code mentioned in the original post?

I think the "Role specific tracking settings" part of this module really would be more appropriate if it had a "negate" option to NOT TRACK the checked roles. Since EVERY registered user is an Authenticated User it makes it very difficult to track just Anonymous and Authenticated users (who don't have administrative roles). Having the users manually "opt out" of tracking is not a fix here since you have to rely on individuals to take an action that should happen automatically.

Hmmm, i just thought of a possible workaround if the maintainer(s) are not interested in including this feature:
1) Track by default and allow users to opt-out in the GA Module
2) Disable the opt-out function for the role you don't want to track in Permissions
3) Create an action with the Rules module to set opt-out to "true" when a user is assigned the role in question.

waddaya think? Also please don't forget my original question above...

hass’s picture

Status: Active » Closed (fixed)

So could someone tell me where exactly I would put the PHP code mentioned in the original post?

Please RTFM as it was written for You and have this PHP examples.

Everything works out of the box as Blocks visibility works and this is by design until blocks logic change.

nodecode’s picture

OK i understand now...

In the GA Module settings under "Page specific tracking settings" i select "Add if the following PHP code returns TRUE (PHP-mode, experts only)" and then paste the edited PHP code in the box below.

So is the Super User tracked too? Would i have to add the super user to one of the excluded roles to exclude them from page tracking?

Thanks, nice work btw.

hass’s picture

No, disable tracking of user 1 in user/1/edit

aren cambre’s picture

Title: Exclude admin from tracking » Exclude by role
Version: 6.x-2.2 » 6.x-2.x-dev
Component: Documentation » Code
Category: support » feature
Status: Closed (fixed) » Active

Can some kind of "exclude by role" feature be built into the module?

hass’s picture

Title: Exclude by role » Exclude admin from tracking
Component: Code » Documentation
Category: feature » support
Status: Active » Closed (fixed)

Don't high-jack cases please. Only as a note - you can do this in the GA module. See the DOC pages, please.

nodecode’s picture

Aren,
There is an "exclude by role" feature, that's what this thread is all about...but you have to do a little cut-n-paste with some code. Click the link mentioned in the first post of this thread, read it carefully, on that page there is some code for Drupal 5 and 6. Copy the code from that document page and then paste it in the appropriate field on the Google Analytics Settings page. Look at my last post #9 which spells out exactly what to do to get this working. Then, in the code you just pasted, edit the list of roles you do not want tracked to match your own preferences.