Google Analytics

Documentation courtesy of Bill Brown, Web Application Developer, from The University of Chicago

Assuming you have a working uPortal instance, follow the instructions below to configure Google Analytics:

Step 1: Create a Google Analytics Account

Create a Google Analytics account at www.google.com/analytics

Step 2: Configure Google Analytics in uPortal

There are two ways to configure the Google Analytics feature in uPortal

Option 1: Configure through the UI

  1. Login as an administrator
  2. Go to the Portal Administration portlet (Under the Admin Tools tab) and click on the Manage Portlets link
  3. Search for "Google Analytics configuration" and click Edit
  4. Click on the "Edit Rich Configuration"  link
  5. Enter your Google Analytics Tracking Id under "Property Id"
  6. To track groups (faculty, staff, etc..), enter an id followed by a group under the "Dimensions" input field. 
    1. For example,  1  : UCM Staff  (see image below)
  7. Complete the form with YOUR Google Analytics and Group details and click "Save"

Example image provided by The University of California, Merced

 

When adding dimensions, the dimension name should match the name configured in google analytics and the value should match the uPortal group name.   When a page is loaded, uPortal will determine which dimensions to include by looping over the list of dimensions and then checking if the current user is a member of that uPortal group.  

uPortal also supports configuration of multiple hosts.  Additional hosts can be added by clicking on the "Add Host" button.   Each host can have it's own google analytics ID, settings and dimensions.   The google analytics portlet in uPortal will look for configurations where the hostname matches the hostname included in the request.   If a matching host configuration is found, it will be used.   If no matching host configuration is found, then the default configuration will be used.

 

Option 2: Configure through the portlet definition file

  • Open the portlet definition file at uPortal/uportal-war/src/main/data/quickstart_entities/portlet-definition/google-analytics-config.portlet-definition.xml
  • Uncomment the "defaultConfig" section and modify with your Google Analytics information (see example configuration below)
  • Import the updated file one of two ways:
    • Use the data-import command (ant data-import -Dfile=uPortal/uportal-war/src/main/data/quickstart_entities/portlet-definition/google-analytics-config.portlet-definition.xml)
    • Or, upload the modified file through the interface
      • Go to the Portal Administration portlet (Under the Admin Tools tab) and click on the Import, Export, and Delete Entities link
      • Click the "Choose File" Button and upload the modified google-analytics-config.portlet-definition.xml

 

uPortal/uportal-war/src/main/data/quickstart_entities/portlet-definition/google-analytics-config.portlet-definition.xml

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <title>Google Analytics Configuration</title>
    <name>Google Analytics Configuration</name>
    <fname>google-analytics-config</fname>
    <desc></desc>
    <type>Portlet</type>
    <timeout>1000</timeout>
    <portlet-descriptor>
        <ns2:isFramework>true</ns2:isFramework>
        <ns2:portletName>GoogleAnalytics</ns2:portletName>
    </portlet-descriptor>
    <group>Everyone</group>
    <parameter>
        <name>alternate</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>blockImpersonation</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>disableDynamicTitle</name>
        <value>true</value>
    </parameter>
    <parameter>
        <name>editable</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hasAbout</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hasHelp</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hideFromMobile</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>highlight</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>showChrome</name>
        <value>false</value>
    </parameter>
    <portlet-preference>
        <name>config</name>
        <readOnly>false</readOnly>
        <value>
{
   "defaultConfig":{
      "name":"",
      "propertyId":"UA-12345678-6",
      "config":[
      ],
      "dimensionGroups":[
         {"name":"1","value":"Administrators"},
         {"name":"2","value":"Applicant - Graduate"},
         {"name":"3","value":"Applicant - Professional"},
         {"name":"4","value":"Applicant - Special"},
         {"name":"5","value":"Applicant - Undergraduate"},
         {"name":"6","value":"Facstaff"},
         {"name":"7","value":"Facstaff - Former Appointment"},
         {"name":"8","value":"Former Student"},
         {"name":"9","value":"Not Portal Activated"},
         {"name":"10","value":"Portal Ineligible"},
         {"name":"11","value":"Student"},
         {"name":"12","value":"System Portal Ineligible"},
         {"name":"13","value":"Users - Advisors"},
         {"name":"14","value":"Users - Instructors"}
      ]
   },
   "hosts":[
      {
         "name":"my-qa.wisconsin.edu",
         "propertyId":"UA-12345678-7",
         "config":[
         ],
         "dimensionGroups":[
            {"name":"1","value":"UW System-Colleges"},
            {"name":"2","value":"UW System-Eau Claire"},
            {"name":"3","value":"UW System-Extension"},
            {"name":"4","value":"UW System-Green Bay"},
            {"name":"5","value":"UW System-La Crosse"},
            {"name":"6","value":"UW System-Madison"},
            {"name":"7","value":"UW System-Milwaukee"},
            {"name":"8","value":"UW System-Oshkosh"},
            {"name":"9","value":"UW System-Parkside"},
            {"name":"10","value":"UW System-Platteville"},
            {"name":"11","value":"UW System-River Falls"},
            {"name":"12","value":"UW System-Stevens Point"},
            {"name":"13","value":"UW System-Stout"},
            {"name":"14","value":"UW System-Superior"},
            {"name":"15","value":"UW System-System Administration"},
            {"name":"16","value":"UW System-Whitewater"}
      ]
      }
   ]
}
        </value>
    </portlet-preference>
</portlet-definition>

 

Step 3: Create Custom Dimensions in Google Analytics

After configuring your Google Analytics Configuration portlet above, we need to map the dimensions you created above with Google Analytics. This means the id's you created per group need to match with the index id's you create in Google Analytics. See below for instructions:

  1. Login to your Google Analytics account
  2. Click on the "Admin" link at the top of the screen
  3. Select the Account and Property that corresponds with your uPortal instance
  4. From the Property section, click on "Custom Definitions" then click "Custom Dimensions" (click image below to view full screen)
  5. After clicking on the "Custom Dimensions" a new page will open up. Click on the "New Custom Dimension" button
  6. Upon clicking on the "New Custom Dimension", it will start at an index value of 1
  7. Fill out the form with the first group you defined above in your Google Analytics Configuration portlet in Step 2. (In above example, we would start with "UCM Staff")

  8. Continue to enter new custom dimensions in the same order as your Google Analytics Configuration portlet. Click example image below to zoom in to see how the dimension indexes below match up to the same sequence ids as the portlet in Step 2.

  9. You have completed creating dimensions now lets create a custom report! (smile)

     Example images provided by The University of California, Merced

Step 4: Create a Custom Report in Google Analytics

Using the example groups above we will create a custom report to demonstrate how we can use dimensions.

Let's start by creating a simple report.....

  1. Click on the "Customization" link at the top of the page to create a new report
  2. Click the "New Custom Report" button
  3. A new custom report form will display. Let's make a report to display the student population by filling out the details.
    1. In this step, we will use the example group "Authenticated Users" as shown in Step 1 and fill out the form accordingly:
      1. Title: Campue Users
      2. Under Report Content, give the report a name (ie., Campus)
      3. Type: Explorer
      4. Metric Groups: Sessions (You can use whichever metrics you would like, in this example we will just demonstrate sessions)
      5. Dimensions Drilldown: Enter your dimension that matches your portal group(s) (ie, Authenticated Users)
      6. Click "Save" (click the image below to view larger)


Next, let's use Segments to show a breakdown of the campus population....

  1. After you click save above, a graph is shown with your data. Click on the down arrow below the "Edit" link (see image below)
     
  2. After you click the arrow, many built-in Segments are available. However, we are going to create a new Segment by clicking on the "Create New Segment" button
  3. Fill out the "Create a New Segment" form like below
    1. Segment Name: Students
    2. Click "Conditions"
    3. Under Filter, enter your portal group in the first field.  (ie., Students, Faculty, Staff, etc....)
    4. Next, select "exactly matches" from the drop-down menu
    5. In the second input field, enter your portal group again (Image below uses the example data "UCM Students" shown in Step 1)
    6. Repeat these steps to create additional Segments such as Staff and Faculty.



      Example image provided by The University of California, Merced
  4. After you finish creating your segments, click the down arrow again to select the segments you created
  5. You're done! Your graph should now display your Authenticated Users and a breakdown of your portal groups represented in different color graph lines  (see image below)

 

 

Notes

  • If you only have one domain you want to track, you only need the default.
  • You should start seeing the traffic in "real time" mode immediately after clicking save (or uploading the entity file). No reboot required.
  • The custom dimensions are only accessible in there custom reporting section.
  • You will see page hits as /tab/<tabname> and /portlet/<portletname>
  • Desktop views can skew results as if they are in normal view all the portlets will get a page hit.
  • Outbound links are also tracked.

Step 5: Add Filters to limit amount of Raw Events data is stored in database

With Google Analytics providing the primary reporting infrastructure, you can make your uPortal and database servers more efficient by filtering out some of the portal Events stored in the UP_RAW_EVENTS table and avoiding Aggregation Event processing on those events.  See the pages Event Persistence Configuration and Event Aggregation Configuration for more information.

 

Having problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org