Google Analytics

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"?>

<portlet-definition version="4.0" xsi:schemaLocation="https://source.jasig.org/schemas/uportal/io/portlet-definition https://source.jasig.org/schemas/uportal/io/portlet-definition/portlet-definition-4.0.xsd" xmlns:ns2="https://source.jasig.org/schemas/uportal" xmlns="https://source.jasig.org/schemas/uportal/io/portlet-definition" xmlns:ns4="https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor" xmlns:ns3="https://source.jasig.org/schemas/uportal/io/event-aggregation" xmlns:ns5="https://source.jasig.org/schemas/uportal/io/permission-owner" xmlns:ns6="https://source.jasig.org/schemas/uportal/io/subscribed-fragment" xmlns:ns7="https://source.jasig.org/schemas/uportal/io/portlet-type" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns8="https://source.jasig.org/schemas/uportal/io/user">

    <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>