washborodems Tumblr blog customizations

Include blogger redirect code, and Google Analytics support

by Chris Vitalos

HTML

<DOCTYPE html>

  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
      $.ajax(document.location.href, {
        type: 'HEAD'
      }).fail(
        function(jqXHR, textStatus, errorThrown) {
          if (jqXHR.status == 404)
            if (document.location.href.search(document.location.protocol + '//' + document.domain + "/202[0-9]/[0-1][0-9]/") != -1) {
              location.href = document.location.href.replace(document.domain, "www.washborodems.org");
            } else {
              location.href = document.location.protocol + '//' + document.domain + '/not-found';
            }
        });

    </script>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async='async' src='https://www.googletagmanager.com/gtag/js?id=UA-170629295-2'></script>
    <script>
      window.dataLayer = window.dataLayer || [];

      function gtag() {
        dataLayer.push(arguments);
      }
      gtag('js', new Date());
      gtag('config', 'UA-170629295-2');

    </script>
    <!-- Global site tag (gtag.js) - Google Analytics -->
  </head>
</DOCTYPE>