How to configure Site Analytics with user profile properties

The Site Analytics app supports tracking user profile properties from Entra ID.

Caution: To preserve anonymity, we strongly recommend tracking only non-identifiable user profile properties.

Google Analytics configuration

Before logging user events with Site Analytics, you must create custom dimensions in Google Analytics. These dimensions allow filtering and reporting on user data within the Google Analytics interface.

    1. Navigate to your Google Analytics property and click on the Admin button located in the bottom left.
    2. Under the Data display section, click on Custom definitions.
    3. Click on Create custom dimension.
    4. Enter the dimension details for the user profile properties you want to track.

      Tip: You will need the internal name for the Entra ID profile property. See the Internal names section at the bottom of this guide, specifically the 'Google Analytics - Event parameter' column.



      Note: Ensure the Event parameter field for custom dimensions is correctly formatted:

      • The Event parameter must be in lowercase.
      • If a profile property's internal name contains special characters, replace them with an underscore (_).
      • For Extension attributes, replace the internal name prefix with "ext_". Example: onPremisesExtensionAttributes.extensionAttribute1 becomes ext_extensionattribute1.

       

    5. Here are example custom dimensions tracking the Department property and Extension attribute 1 from Entra ID

      Dimension name Scope Event parameter
      Department User department
      Extension Attribute 1 User ext_extensionattribute1
    6. Click Save to create the custom dimension.

SharePoint configuration

Next, configure the Site Analytics app to collect and send user profile data to Google Analytics.

  1. Follow the steps in our final configuration guide to obtain your Google Tag Manager container ID
  2. Navigate to the Site Analytics configuration panel in SharePoint.
  3. Click on Advanced mode. In this panel, you can insert JSON to instruct the Site Analytics app which user profile properties to retrieve and send.
  4. Following our previous example, the JSON below instructs Site Analytics to retrieve the Department property and Extension attribute 1 from Entra ID.

    Replacing the bold item in the JSON below will connect the Site Analytics app to your Google Tag Manager container.

    Tip: You will again need the internal name for the Entra ID profile property. See the Internal names section at the bottom of this guide, specifically the 'Internal name' column.


    {
      "version": 2,
      "trackingId": "[Insert GTM container ID]",
      "custom": false,
      "userProfileProperties": [
        {
          "field": "department",
          "source": "AAD"
        },
        {
          "field": "onPremisesExtensionAttributes.extensionAttribute1",
          "source": "AAD"
        }
      ]
    }
  5. Click on Save. The Site Analytics app will validate your configuration.


Internal names

Use the table below to find the correct internal names for common user profile properties in Entra ID.

Profile property Internal name Google Analytics - Event parameter
Department department department
Job title jobTitle jobtitle
Employee type employeeType employeetype
Office location officeLocation officelocation
City city city
State or province state state
Country or region country country
Extension attribute onPremisesExtensionAttributes.extensionAttribute1 ext_extensionattribute1