Note – while it is certainly possible to install the Google Analytics code directly on your site, we strongly recommend that you use Google Tag Manager to launch the analytics code rather than coding it directly on your site.

While adding multiple tracking codes to your website is a bit more involved than adding a single code, it is not difficult.  We recommend that most websites at the department or higher level do use this method so that the main university tracking code can be included.  That code will be used in the example below.

Add the following code within the <head> section of your page.  Note that the javascript is asynchronous so having it at the top of your page will not block the rest of your site from rendering or slow down your download speed.

Note that this code is similar to the default except that it adds a couple of extra lines for the second tracking tag.

In this example, replace UA-XXXXXXX-3 with your own tracking code and domain.com with your own site domain.  The second code is the university code and can be left as is.

<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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-3', 'domain.com');
ga('create', 'UA-1617721-2', {'name':'b'});
ga('send', 'pageview');
ga('b.send', 'pageview');
</script>