<commit_before>(function(Modules) {
  "use strict";
  Modules.TabSwitcher = function() {
    this.start = function(element) {
      element.on('show.bs.tab', function(e) {
        if (window.history && window.history.replaceState) {
          window.history.replaceState(null, null, $(e.target).attr('href'));
        }

        // Shim Boostrap tabs, which are only capabable of removing
        // the active class from a tab-pane that is a direct child of
        // the tab-content container. See:
        // https://github.com/twbs/bootstrap/blob/master/js/tab.js#L52
        //
        // Works in conjunction with:
        // https://github.com/alphagov/publisher/blob/master/app/assets/stylesheets/bootstrap_and_overrides.css.scss#L98-L110
        resetAllTabs();
      });

      function resetAllTabs() {
        element.find('.tab-pane').each(function() {
          $(this).removeClass('active');
        });
      }

    }
  };<commit_msg>Track tab switch as pageview<commit_after>(function(Modules) {
  "use strict";
  Modules.TabSwitcher = function() {
    this.start = function(element) {
      element.on('show.bs.tab', function(e) {
        if (window.history && window.history.replaceState) {
          window.history.replaceState(null, null, $(e.target).attr('href'));

          // Track tab switch as pageview
          // https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
          if (typeof ga === "function") {
            ga('send', 'pageview');
          }
        }

        // Shim Boostrap tabs, which are only capabable of removing
        // the active class from a tab-pane that is a direct child of
        // the tab-content container. See:
        // https://github.com/twbs/bootstrap/blob/master/js/tab.js#L52
        //
        // Works in conjunction with:
        // https://github.com/alphagov/publisher/blob/master/app/assets/stylesheets/bootstrap_and_overrides.css.scss#L98-L110
        resetAllTabs();
      });

      function resetAllTabs() {
        element.find('.tab-pane').each(function() {
          $(this).removeClass('active');
        });
      }

    }
  };
{'fraction_non_alphanumeric': 0.14519140989729226, 'fraction_numerical': 0.006535947712418301, 'mean_word_length': 2.227409638554217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6806992', 'n_tokens_mistral': 654, 'n_tokens_neox': 636, 'n_words': 118}