SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building an Intranet site and I am going to use Google Analytics for the statistics. I was wondering if there is any way to segment visitors using Google Analytics taking the information from some fields in the User Profile (Category of the employee, Office Location and Department among others). For example, I need to track all pages visited by "Managers AND/OR Barcelona AND/OR belonging to Human Resources department".

Any idea? Thank you

share|improve this question
up vote 0 down vote accepted

You can create Custom Varaibles for google analytics. You then just need to collect the information from the user profile and pass it to GA.

Example of setting a custom GA variable:

      1,                   // This custom var is set to slot #1.  Required parameter.
      'Items Removed',     // The name acts as a kind of category for the user activity.  Required parameter.
      'Yes',               // This value of the custom variable.  Required parameter.
      2                    // Sets the scope to session-level.  Optional parameter.

How to get User Profile properties:

var office = SP.UserProfiles.PersonProperties.get_userProfileProperties()["Office"]
share|improve this answer
I am using Universal Analytics so the custom vars are replaced by custom dimensions. Do you know how to set them? – Alvmad Apr 2 '13 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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