<div class="article-container outcome">
  <article class="outcome group">
    <div class="result-info">
      <div class="inner group">
        <% if @presenter.current_node.has_title? %>
        <div class="summary"><h2 class="result-title"><%= @presenter.current_node.title %></h2></div>
        <% end %>
        <% if @presenter.current_node.has_body? %>
          <%= @presenter.current_node.body %>
        <% end %>
      </div>
    </div>
    <% if @presenter.current_node.has_next_steps? %>
      <div class="related-wrapper">
        <div class="related next-steps">
          <h2>Next steps</h2>
          <%= @presenter.current_node.next_steps %>
        </div>
      </div>
    <% end %>
  </article>
</div>

<div class="article-container outcome">
  <article class="outcome group">
    <div class="result-info">
      <div class="inner group">
        <% if @presenter.current_node.has_title? %>
        <div class="summary"><h2 class="result-title"><%= @presenter.current_node.title %></h2></div>
        <% end %>
        <% if @presenter.current_node.has_body? %>
          <%= @presenter.current_node.body %>
        <% end %>
      </div>
    </div>
    <% if @presenter.current_node.has_next_steps? %>
      <div class="related-wrapper">
        <div class="related next-steps">
          <h2>Next steps</h2>
          <%= @presenter.current_node.next_steps %>
        </div>
      </div>
    <% end %>
  </article>
</div>

<script type="text/javascript">
  var flowName = '<%= @name %>';
  GOVUK.analytics.trackEvent('Smart Answer', 'Completed', {label: flowName, nonInteraction: true});
</script>

Add Google Analytics Event to outcome pages
Add Google Analytics Event to outcome pages

We hope that recording an event when someone reaches an outcome will help us
understand more about how Smart Answers are used.

We initially investigated using Virtual Pageviews (see PR #1700 for that
discussion) before settling on Events. This approach was suggested by Chris
Russell.

I tested this locally by configuring my local static app to send data to my
personal Google Analytics account and confirming that the events appear as
expected.
