Using Google Tag Manager
The most effective way to implement the University Google Analytics Roll-Up is to implement Google Tag Manager on your website and import the Mason Google Tag Manager Template Container, which provides for an easy and consistent tracking method across Mason websites. Learn more about the Mason Google Tag Manager Template Container.
In HTML/Javascript
If you are not using Google Tag Manager, and instead are implementing Google Analytics directly in your website via HTML/Javascript, you can customize the default Google Analytics snippet by adding a few additional lines which tell Google Analytics to also send your tracking data to the university roll-up.
Default Google Analytics JavaScript Snippet
Here is the standard Google Analytics implementation script:
<script> (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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); </script>
Custom Google Analytics JavaScript Snippet With One Roll-Up Property
Here is a modified Google Analytics implementation script, which includes the university roll-up:
<script> (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','https://www.google-analytics.com/analytics.js','ga'); //Individual website ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); //University-level roll-up ga('create', 'UA-1007599-1', 'auto', 'rollUp_Mason'); ga('rollUp_Mason.send', 'pageview'); </script>
Custom Google Analytics JavaScript Snippet With Two Roll-Up Properties
Here is a modified Google Analytics implementation script, which includes both the university roll-up and a second unit/department-level roll-up:
<script> (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','https://www.google-analytics.com/analytics.js','ga'); //Individual website ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); //Department-level roll-up ga('create', 'UA-XXXXXXXX-X', 'auto', 'rollUp_department'); ga('rollUp_department.send', 'pageview'); //University-level roll-up ga('create', 'UA-1007599-1', 'auto', 'rollUp_Mason'); ga('rollUp_Mason.send', 'pageview'); </script>
In a CMS Like Drupal/WordPress
If you are using a CMS to run your website, it is unlikely that you would modify HTML directly to change your Google Analytics JavaScript snippet. Most likely, the CMS uses a module or plugin to provide for Google Analytics (or Google Tag Manager) functionality. Many such plugins exist, and many offer customization options to allow you to add the custom code as described in the HTML/JavaScript section above.
Learn more about GA integration options in Drupal.
See more information about how to implement Google Analytics in WordPress.