Google Analytics

Here are the steps on how to setup the Google Analytics statewide code on your website.

(A) If you are using the state template you do not need to install the statewide analytics code as it’s already part of the state template.  So no action is required on your part.

(B) If you are using your own custom template, simple copy and paste the following piece of code into the <HEAD> section of every page on your site.

Also, be sure to change the agency GA tag currently listed as UA-20973992-30 to your own.

<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
        
        <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());

            //statewide GA property
                gtag('config', 'UA-3419582-2'); 
            //please update state department UA code in line below before deployment	
                gtag('config', 'UA-20973992-30');

            var getOutboundLink = function(url) {
            gtag('event', 'click', {
                'event_category': 'navigation',
                'event_label': 'outbound link: ' + url,
                'transport_type': 'beacon',
                'event_callback': function(){document.location = url;}
            });
            }

            var trackDownload = function(filename) {
            gtag('event', 'click', {
                'event_category': 'download',
                'event_label': 'file: ' + filename,
                'transport_type': 'beacon',
                'event_callback': function(){document.location = url;}
            });
            }


        </script>