<style>
  .feedback--answer {
    display: inline-block;
  }
  .feedback--answer-no {
    margin-left: 1em;
  }
  .feedback--response {
    display: none;
    margin-top: 1em;
  }
  .feedback--response__visible {
    display: block;
  }
</style>
<!--<div class="d-print-none">-->
<!--<h2 class="feedback&#45;&#45;title">Feedback</h2>-->
<!--<p class="feedback&#45;&#45;question">Was this page helpful?</p>-->
<!--<button class="btn btn-primary mb-4 feedback&#45;&#45;answer feedback&#45;&#45;answer-yes">Yes</button>-->
<!--<button class="btn btn-primary mb-4 feedback&#45;&#45;answer feedback&#45;&#45;answer-no">No</button>-->
<!--<p class="feedback&#45;&#45;response feedback&#45;&#45;response-yes">-->
<!--  {{ .yes | safeHTML }}-->
<!--</p>-->
<!--<p class="feedback&#45;&#45;response feedback&#45;&#45;response-no">-->
<!--  {{ .no | safeHTML }}-->
<!--</p>-->
<!--</div>-->
<script>
  const yesButton = document.querySelector('.feedback--answer-yes');
  const noButton = document.querySelector('.feedback--answer-no');
  const yesResponse = document.querySelector('.feedback--response-yes');
  const noResponse = document.querySelector('.feedback--response-no');
  const disableButtons = () => {
    yesButton.disabled = true;
    noButton.disabled = true;
  };
  const sendFeedback = (value) => {
    if (typeof ga !== 'function') return;
    const args = {
      command: 'send',
      hitType: 'event',
      category: 'Helpful',
      action: 'click',
      label: window.location.pathname,
      value: value
    };
    ga(args.command, args.hitType, args.category, args.action, args.label, args.value);
  };
  yesButton.addEventListener('click', () => {
    yesResponse.classList.add('feedback--response__visible');
    disableButtons();
    sendFeedback(1);
  });
  noButton.addEventListener('click', () => {
    noResponse.classList.add('feedback--response__visible');
    disableButtons();
    sendFeedback(0);
  });
</script>
