<commit_before><%
  heading ||= false
  heading_padding ||= false
  border_top ||= false
  country_guidance ||= false
  accordion_contents = []
  number_of_accordion_sections = accordions.length
%>
<% accordions.each_with_index do | section, index | %>
  <% content = capture do %>
    <%# this element captures an override from the accordion that the last item has margin 0 %>
    <div class="covid__accordion-inner">
      <%= render partial: 'coronavirus_landing_page/components/shared/section', locals: { section: section } %>
    </div>
  <% end %>
  <%
    additional_contents = {
      heading: {
        text: section["title"],
      },
      content: {
        html: content,
      },
      data_attributes: {
        toggle_attribute: "data-track-action",
        when_closed_text: "accordionClosed",
        when_open_text: "accordionOpened",
        track_category: "pageElementInteraction",
        track_action: "accordionClosed",
        track_label: section["title"],
        track_dimension: number_of_accordion_sections,
        track_dimension_index: 26,
        gtm_event_name: "select_content",
        gtm_attributes: {
          type: 'accordion',
          text: section["title"],
          index: index + 1,
          'index-total': number_of_accordion_sections,
          section: 'n/a',
          action: 'n/a',
        }
      }
    }

    additional_contents[:summary] = { text: section["sub_heading"] } if section["sub_heading"]

    accordion_contents << additional_contents
  %>
<% end %>
<%= render "govuk_publishing_components/components/heading", {
  text: heading,
  padding: heading_padding,
  border_top: border_top,
  font_size: "m"
} if heading %>
<div data-module="gem-track-click gtm-click-tracking">
  <div data-module="toggle-attribute">
    <%
      show_all_attributes = {
        type: "accordion",
        index: 0,
        "index-total": number_of_accordion_sections,
        section: "n/a"
      }
    %>
    <%= render 'govuk_publishing_components/components/accordion', {
      heading_level: 3,
      data_attributes: {
        module: "govuk-accordion"
      },
      data_attributes_show_all: {
        "gtm-event-name": "select_content",
        "gtm-attributes": show_all_attributes.to_json
      },
      items: accordion_contents,
      margin_bottom: 3
    } %>
  </div>
</div><commit_msg>Update GTM tracking attributes<commit_after><%
  heading ||= false
  heading_padding ||= false
  border_top ||= false
  country_guidance ||= false
  accordion_contents = []
  number_of_accordion_sections = accordions.length
%>
<% accordions.each_with_index do | section, index | %>
  <% content = capture do %>
    <%# this element captures an override from the accordion that the last item has margin 0 %>
    <div class="covid__accordion-inner">
      <%= render partial: 'coronavirus_landing_page/components/shared/section', locals: { section: section } %>
    </div>
  <% end %>
  <%
    additional_contents = {
      heading: {
        text: section["title"],
      },
      content: {
        html: content,
      },
      data_attributes: {
        toggle_attribute: "data-track-action",
        when_closed_text: "accordionClosed",
        when_open_text: "accordionOpened",
        track_category: "pageElementInteraction",
        track_action: "accordionClosed",
        track_label: section["title"],
        track_dimension: number_of_accordion_sections,
        track_dimension_index: 26,
        ga4: {
          event_name: 'select_content',
          type: 'accordion',
          text: section["title"],
          index: index + 1,
          index_total: number_of_accordion_sections,
          section: 'n/a',
          action: 'n/a',
        }
      }
    }

    additional_contents[:summary] = { text: section["sub_heading"] } if section["sub_heading"]

    accordion_contents << additional_contents
  %>
<% end %>
<%= render "govuk_publishing_components/components/heading", {
  text: heading,
  padding: heading_padding,
  border_top: border_top,
  font_size: "m"
} if heading %>
<div data-module="gem-track-click gtm-click-tracking">
  <div data-module="toggle-attribute">
    <%
      show_all_attributes = {
        event_name: "select_content",
        type: "accordion",
        index: 0,
        index_total: number_of_accordion_sections,
        section: "n/a"
      }
    %>
    <%= render 'govuk_publishing_components/components/accordion', {
      heading_level: 3,
      data_attributes: {
        module: "govuk-accordion"
      },
      data_attributes_show_all: {
        "ga4": show_all_attributes.to_json
      },
      items: accordion_contents,
      margin_bottom: 3
    } %>
  </div>
</div>
{'fraction_non_alphanumeric': 0.1228370006408887, 'fraction_numerical': 0.0034180730613116855, 'mean_word_length': 2.766693483507643, 'pattern_counts': {'":': 4, '<': 41, '<?xml version=': 0, '>': 37, 'https://': 0, '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': '1376930', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1418, 'n_words': 274}