0

I have the Google Analytics module installed. How can I prohibit the code snippet appearing on pages served to a particular user. Say user #15, for example?

2 Answers 2

1

I would consider creating a separate user role for that purpose and disabling Google Analytics for that role. The setting can be found at the module config page (/admin/config/system/googleanalytics) under Tracking Scope -> Roles.

1

I don't think you need to create a new role just to stop tracking a single user. If you want the user to be able to opt-out from being tracked, go to the Google Analytics module settings page (/admin/config/system/googleanalytics) and under Tracking Scope -> Users, select:

"Tracking on by default, users with opt-in or out of tracking permission can opt out"

Google Analytics module settings page

Then you can give user roles you wish (e.g. "Authenticated User") permission to opt-out of Google Analytics tracking ("Opt-in or out of tracking").

The user can then log in to their account and opt out of tracking.

Having said that, if you want to prohibit a certain user from being tracked, or you don't want to give anybody else permission to opt out, then I agree that adding a new user role might be the best way to go for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.