You are here: Administration > Settings > Site Settings > Configure visitor tracking for Google Universal Analytics

Configure visitor tracking for Google Universal Analytics

If you use Google Universal Analytics reports to track website user behavior such as search patterns, you can add code to the script you receive from Google Universal Analytics to monitor whether users are logged into the website or visiting when they perform searches. Add the code to the script you entered when you enabled tracking in Blackbaud NetCommunity so the program includes the additional tracking requirements on each page of your website.

Note: Search metrics are pulled from the Search and Quick Search parts in Blackbaud NetCommunity.

1. From your Google Universal Analytics account, create a custom dimension to track logged in users for the property that corresponds to your Blackbaud NetCommunity website. A custom dimension is a way to send custom data to Google Universal Analytics so you can view the information in reports. For detailed information about custom dimensions, refer to the Google Universal Analytics help documentation.
2. Open Blackbaud NetCommunity. On the Administration page, select Sites & settings.
3. Select the site to configure and then select the Settings tab.
4. In the Site Tracking Script box, add this section of code to the Google Universal Analytics script you entered when you enabled site tracking for the website. Add the code below the information in the field before </script>. For information about how to enable site tracking, see Site tracking settings.

Note: When you enter the code, use the name you entered for your custom dimension for <replace with custom dimension name>.

     if (LOGGEDIN) {
         ga('set', '<replace with custom dimension name>', LOGGEDIN);
     } else {
         ga('set', '<replace with custom dimension name>', 'Visitor');
     }

The combined script should look similar to the one below. Your version should include the account ID provided by Google Universal Analytics in place of UA-XXXXXXXX-Y. Also, if you are testing your website locally, replace ga('create', 'UA-XXXXXX-Y', 'auto'); with ga('create', 'UA-XXXXXX-Y', {'cookieDomain': 'none'});.

     <script type="text/javascript">
         (function (i, s, o, g, r, a, m) {
             i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
                 (i[r].q = i[r].q || []).push(arguments)
             }, i[r].l = 1 * new Date(); a = s.createElement(o),
             m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
         })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
         ga('create', 'UA-XXXXXXXX-Y', 'auto');
         ga('send', 'pageview');
      if (LOGGEDIN) {
         ga('set', '<replace with custom dimension name>', LOGGEDIN);
     } else {
         ga('set', '<replace with custom dimension name>', 'Visitor');
     }
     </script>
5. To save the settings, click Save.