Google Analytics+ Hooks (Add additional JS)

Hi There,

I want to add some additional javascript into the Google Analytics script.

So I end up with something like this:

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-XXXXXXXX-X', '');
ga('send', 'pageview');

window.onload = function() {
  var a = document.getElementsByTagName('a');
  for (i = 0; i < a.length; i++) {
    if (a[i].hostname === location.hostname) {
      if (a[i].href.match(/^https?:\/\/.+\.(zip|dmg|txt|cfg|gz|pl|pdf)$/i)) {
        a[i].setAttribute('target', '_blank');
        a[i].onclick = function() {
          ga('send', 'event', 'Downloads', 'Click', this.getAttribute('href'));

Is there a hook I can use to add the additional js.

The additional Js is used to track downloads.

Thank you in advance.