diff --git a/app/presenters/organisations/people_presenter.rb b/app/presenters/organisations/people_presenter.rb index 11ed09efa..0e0c29d73 100644 --- a/app/presenters/organisations/people_presenter.rb +++ b/app/presenters/organisations/people_presenter.rb @@ -18,6 +18,7 @@ def all_people { type: person_type, title: I18n.t("organisations.people.#{person_type}"), + ga4_english_title: I18n.t("organisations.people.#{person_type}", locale: :en), lang: t_fallback("organisations.people.#{person_type}"), people: people.map { |person| formatted_person_data(person, person_type) }, } diff --git a/app/views/components/_topic_list.html.erb b/app/views/components/_topic_list.html.erb index af351caca..9b1776fba 100644 --- a/app/views/components/_topic_list.html.erb +++ b/app/views/components/_topic_list.html.erb @@ -6,6 +6,8 @@ margin_bottom ||= false ga4_data ||= {} + ul_data_attributes = { "module": "ga4-link-tracker", "ga4-track-links-only": "" } if !ga4_data.empty? + brand ||= false brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand) @@ -15,7 +17,7 @@ ul_classes << brand_helper.brand_class if brand %> <% if items.any? %> - <%= tag.ul(class: ul_classes, lang: "en") do %> + <%= tag.ul(class: ul_classes, lang: "en", data: ul_data_attributes) do %> <% items.each_with_index do |item, index| %>
  • <% diff --git a/app/views/organisations/_contacts.html.erb b/app/views/organisations/_contacts.html.erb index 3f1033da2..0ac0155b2 100644 --- a/app/views/organisations/_contacts.html.erb +++ b/app/views/organisations/_contacts.html.erb @@ -1,4 +1,9 @@ <% if contacts.present? %> +<% + ga4_section ||= nil + ga4_email_link_data = { event_name: "navigation", type: "email" } + ga4_email_link_data[:section] = ga4_section if ga4_section + %> <% contacts.each do |contact| %>
    " <%= "lang=#{contact[:locale]}" if contact[:locale] %>> <%= render "govuk_publishing_components/components/heading", { @@ -28,7 +33,13 @@ <% end %> <% contact[:email_addresses].each do |email| %> -

    <%= email.html_safe %>

    +

    + <%= email.html_safe %> +

    <% end %>
    <% end %> diff --git a/app/views/organisations/_corporate_information.html.erb b/app/views/organisations/_corporate_information.html.erb index 216d536cc..ed0fb52af 100644 --- a/app/views/organisations/_corporate_information.html.erb +++ b/app/views/organisations/_corporate_information.html.erb @@ -10,7 +10,7 @@ <% end %> <% if @show.corporate_information[:corporate_information_links][:items].any? && !@organisation.is_no_10? %>
    "> - <%= render "components/topic_list", @show.corporate_information[:corporate_information_links] %> + <%= render "components/topic_list", @show.corporate_information[:corporate_information_links].merge({ ga4_data: { section: t('organisations.corporate_information', locale: :en) } }) %>
    <% end %> @@ -22,7 +22,7 @@ font_size: 24, lang: t_fallback('organisations.jobs_contracts') } %> - <%= render "components/topic_list", @show.corporate_information[:job_links] %> + <%= render "components/topic_list", @show.corporate_information[:job_links].merge({ ga4_data: { section: t('organisations.jobs_contracts', locale: :en) } }) %> <% end %> <% if @organisation.secondary_corporate_information && !@organisation.is_no_10? %> @@ -39,11 +39,11 @@ font_size: 19, padding: true, border_top: 5, - brand: @organisation.brand, + brand: @organisation.brand, lang: t_fallback('organisations.follow_us') } %>
    - <%= render "govuk_publishing_components/components/share_links", @what_we_do.share_links %> + <%= render "govuk_publishing_components/components/share_links", @what_we_do.share_links.merge({ ga4_extra_data: { section: t('organisations.follow_us', locale: :en) }}) %>
    <% end %> diff --git a/app/views/organisations/_courts_header.html.erb b/app/views/organisations/_courts_header.html.erb index 75444c9b3..240860753 100644 --- a/app/views/organisations/_courts_header.html.erb +++ b/app/views/organisations/_courts_header.html.erb @@ -12,6 +12,6 @@
    <%= render "govuk_publishing_components/components/translation_nav", @header.translation_links %> - <%= render "components/topic_list", @header.ordered_featured_links %> + <%= render "components/topic_list", @header.ordered_featured_links.merge({ ga4_data: { section: @header.org.title } }) %>
    diff --git a/app/views/organisations/_featured_news.html.erb b/app/views/organisations/_featured_news.html.erb index d73e31c04..a582548ac 100644 --- a/app/views/organisations/_featured_news.html.erb +++ b/app/views/organisations/_featured_news.html.erb @@ -1,4 +1,11 @@ <% if @documents.has_featured_news? %> +<% + ga4_image_card_json = { + "event_name": "navigation", + "type": "image card", + "section": t('shared.featured', locale: :en) + }.to_json +%> diff --git a/app/views/organisations/_header.html.erb b/app/views/organisations/_header.html.erb index c47917d8c..8b5047655 100644 --- a/app/views/organisations/_header.html.erb +++ b/app/views/organisations/_header.html.erb @@ -20,7 +20,7 @@ <% if @organisation.is_live? %> <% end %> diff --git a/app/views/organisations/_latest_documents.html.erb b/app/views/organisations/_latest_documents.html.erb index 64238ec7d..5405526da 100644 --- a/app/views/organisations/_latest_documents.html.erb +++ b/app/views/organisations/_latest_documents.html.erb @@ -13,17 +13,21 @@
    - <%= render "govuk_publishing_components/components/document_list", @documents.latest_documents %> - + <% ga4_section = t('organisations.latest_from', title: @show.prefixed_title, locale: :en) %> + <%= render "govuk_publishing_components/components/document_list", @documents.latest_documents.merge({ ga4_extra_data: { section: ga4_section }}) %>

    - " class="govuk-link brand__color" <%= t_lang('organisations.see_all_latest_documents') %>> + " + class="govuk-link brand__color" <%= t_lang('organisations.see_all_latest_documents') %> + data-module="ga4-link-tracker" + data-ga4-link="<%= { event_name: "navigation", type: "see all", section: ga4_section }.to_json %>"> <%= t('organisations.see_all_latest_documents') %>

    " data-ga4-track-links-only > <%= render "govuk_publishing_components/components/subscription_links", @show.subscription_links %> diff --git a/app/views/organisations/_latest_documents_by_supergroup.html.erb b/app/views/organisations/_latest_documents_by_supergroup.html.erb index cd19d9b52..c803e96af 100644 --- a/app/views/organisations/_latest_documents_by_supergroup.html.erb +++ b/app/views/organisations/_latest_documents_by_supergroup.html.erb @@ -18,7 +18,7 @@ heading_level: 3, lang: supergroup[:lang] } %> - <%= render "govuk_publishing_components/components/document_list", supergroup[:documents] %> + <%= render "govuk_publishing_components/components/document_list", supergroup[:documents].merge({ ga4_extra_data: { section: t('organisations.document_types.documents', locale: :en)}}) %> > <%= supergroup[:finder_link][:text] %> diff --git a/app/views/organisations/_org_contacts.html.erb b/app/views/organisations/_org_contacts.html.erb index 4718dfde9..37c6211f6 100644 --- a/app/views/organisations/_org_contacts.html.erb +++ b/app/views/organisations/_org_contacts.html.erb @@ -8,6 +8,6 @@ lang: t_fallback("organisations.contact.contact_organisation", { organisation: @show.acronym }) } %> - <%= render partial: 'contacts', locals: { contacts: contacts.contacts, border: true } %> + <%= render partial: 'contacts', locals: { contacts: contacts.contacts, border: true, ga4_section: t('organisations.contact.contact_organisation', organisation: @show.acronym, locale: :en) } %> <% end %> diff --git a/app/views/organisations/_promotional_features.html.erb b/app/views/organisations/_promotional_features.html.erb index f8daa81af..9d3668625 100644 --- a/app/views/organisations/_promotional_features.html.erb +++ b/app/views/organisations/_promotional_features.html.erb @@ -1,7 +1,14 @@ <% if @documents.has_promotional_features? %>
    <% @documents.promotional_features.each do |feature| %> -
    + <% + ga4_image_card_json = { + "event_name": "navigation", + "type": "image card", + "section": feature[:title] + }.to_json + %> +
    <%= render "govuk_publishing_components/components/heading", { text: feature[:title], heading_level: 2, diff --git a/app/views/organisations/_related_people.html.erb b/app/views/organisations/_related_people.html.erb index 2ab7b15ab..458692198 100644 --- a/app/views/organisations/_related_people.html.erb +++ b/app/views/organisations/_related_people.html.erb @@ -1,5 +1,12 @@ <% if people.any? %> -
    + <% + ga4_image_card_json = { + "event_name": "navigation", + "type": "image card", + "section": ga4_english_title + }.to_json + %> +
    <%= render "govuk_publishing_components/components/heading", { @@ -12,7 +19,7 @@
    <% people.in_groups_of(4, false) do |people| %> -
    +
    <% people.each do |person| %>
    <%= render "govuk_publishing_components/components/image_card", person %> diff --git a/app/views/organisations/_standard_org_docs_people.html.erb b/app/views/organisations/_standard_org_docs_people.html.erb index ec2eec83d..193d359c7 100644 --- a/app/views/organisations/_standard_org_docs_people.html.erb +++ b/app/views/organisations/_standard_org_docs_people.html.erb @@ -7,6 +7,7 @@ <%= render partial: 'related_people', locals: { people: people_data[:people], title: people_data[:title], + ga4_english_title: people_data[:ga4_english_title], lang: people_data[:lang], brand: @organisation.brand } %> diff --git a/app/views/organisations/_standard_org_foi_profiles.html.erb b/app/views/organisations/_standard_org_foi_profiles.html.erb index 2cf68dd99..bd0945ee1 100644 --- a/app/views/organisations/_standard_org_foi_profiles.html.erb +++ b/app/views/organisations/_standard_org_foi_profiles.html.erb @@ -8,6 +8,6 @@ padding: true, margin_bottom: 3 } %> - <%= render "components/topic_list", @show.high_profile_groups %> + <%= render "components/topic_list", @show.high_profile_groups.merge({ ga4_data: { section: @show.high_profile_groups[:title] } }) %>
    <% end %> diff --git a/app/views/organisations/_what_we_do.html.erb b/app/views/organisations/_what_we_do.html.erb index 53adabd69..ed1e85a0d 100644 --- a/app/views/organisations/_what_we_do.html.erb +++ b/app/views/organisations/_what_we_do.html.erb @@ -37,7 +37,7 @@ lang: t_fallback('organisations.follow_us') } %>
    - <%= render "govuk_publishing_components/components/share_links", @what_we_do.share_links %> + <%= render "govuk_publishing_components/components/share_links", @what_we_do.share_links.merge({ ga4_extra_data: { section: t('organisations.what_we_do', locale: :en) }}) %>
    <% end %> diff --git a/app/views/subtopics/_subtopic.html.erb b/app/views/subtopics/_subtopic.html.erb index 5b4cac42d..e10f8ea99 100644 --- a/app/views/subtopics/_subtopic.html.erb +++ b/app/views/subtopics/_subtopic.html.erb @@ -31,6 +31,6 @@
    -
    +
    <%= yield %>
    diff --git a/app/views/topics/index.html.erb b/app/views/topics/index.html.erb index ac4ef9f77..5becbcb39 100644 --- a/app/views/topics/index.html.erb +++ b/app/views/topics/index.html.erb @@ -16,7 +16,7 @@ <%= render "govuk_publishing_components/components/title", title: title_with_suffix %> -
    +