-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3784 from alphagov/ga4-homepage-indexes
GA4 homepage indexes
- Loading branch information
Showing
9 changed files
with
165 additions
and
175 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
app/views/homepage/_departments_and_organisations.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<div class="govuk-grid-column-full govuk-grid-column-one-third-from-desktop"> | ||
<section class="homepage-section homepage-section__departments-organisations"> | ||
<div class="homepage-section__heading"> | ||
<%= render "govuk_publishing_components/components/heading", { | ||
font_size: "m", | ||
text: t("homepage.index.departments_and_organisations"), | ||
data_attributes: { | ||
ga4_scroll_marker: true, | ||
}, | ||
} %> | ||
</div> | ||
|
||
<% | ||
# The "big number" component links below are hardcoded separately (i.e. not in a loop in this instance) and therefore their 'index' properties are also hardcoded. | ||
# If a new "big number" component is added or removed, this will need to be reflected in the 'index_link' and 'index_total' properties to ensure that they remain accurate for tracking/analytics purposes. | ||
%> | ||
<div class="homepage-section__depts" data-module="gem-track-click ga4-link-tracker"> | ||
<%= render "govuk_publishing_components/components/big_number", { | ||
number: t("homepage.index.ministerial_departments_count"), | ||
label: t("homepage.index.ministerial_departments"), | ||
href: "/government/organisations#ministerial_departments", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
"track-category": "homepageClicked", | ||
"track-action": "departmentsLink", | ||
"track-label": "/government/organisations#ministerial_departments", | ||
"track-dimension": "#{t("homepage.index.ministerial_departments_count")} #{t("homepage.index.ministerial_departments")}", | ||
"track-dimension-index": 29, | ||
"track-value": 1, | ||
"ga4_link": { | ||
"event_name": "navigation", | ||
"type": "homepage", | ||
"index_section": locals[:index_section], | ||
"index_link": 1, | ||
"index_section_count": locals[:index_section_count], | ||
"index_total": 2, | ||
"section": t("homepage.index.departments_and_organisations", locale: :en), | ||
"text": "#{t("homepage.index.ministerial_departments_count")} #{t("homepage.index.ministerial_departments", locale: :en)}" | ||
} | ||
}, | ||
} %> | ||
<%= render "govuk_publishing_components/components/big_number", { | ||
number: t("homepage.index.other_agencies_count"), | ||
label: t("homepage.index.other_agencies"), | ||
href: "/government/organisations#agencies_and_other_public_bodies", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
"track-category": "homepageClicked", | ||
"track-action": "departmentsLink", | ||
"track-label": "/government/organisations#agencies_and_other_public_bodies", | ||
"track-dimension": "#{t("homepage.index.other_agencies_count")} #{t("homepage.index.other_agencies")}", | ||
"track-dimension-index": 29, | ||
"track-value": 1, | ||
"ga4_link": { | ||
"event_name": "navigation", | ||
"type": "homepage", | ||
"index_section": locals[:index_section], | ||
"index_link": 2, | ||
"index_section_count": locals[:index_section_count], | ||
"index_total": 2, | ||
"section": t("homepage.index.departments_and_organisations", locale: :en), | ||
"text": "#{t("homepage.index.other_agencies_count")} #{t("homepage.index.other_agencies", locale: :en)}" | ||
} | ||
}, | ||
} %> | ||
</div> | ||
</section> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,38 @@ | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full govuk-grid-column-two-thirds-from-desktop" data-module="gem-track-click ga4-link-tracker"> | ||
<section class="homepage-section homepage-section__government-activity"> | ||
<div class="homepage-section__heading"> | ||
<div class="homepage-section__heading-wrapper"> | ||
<%= render "govuk_publishing_components/components/heading", { | ||
font_size: "m", | ||
text: t("homepage.index.government_activity"), | ||
data_attributes: { | ||
ga4_scroll_marker: true, | ||
}, | ||
} %> | ||
</div> | ||
|
||
<%= render "govuk_publishing_components/components/lead_paragraph", { | ||
text: t("homepage.index.government_activity_description"), | ||
margin_bottom: 0 | ||
} %> | ||
</div> | ||
|
||
<ul class="homepage-services-and-info__list"> | ||
<% t("homepage.government_activity").each_with_index do | item, index | %> | ||
<%= render partial: "homepage/chevron_card", locals: { | ||
description: item[:description], | ||
link: item[:link], | ||
title: item[:title], | ||
track_action: "governmentactivityLink", | ||
index_values: { | ||
index_section: 3, | ||
index_link: index + 1, | ||
index_section_count: 6, | ||
}, | ||
index_total: t("homepage.government_activity").length, | ||
section: t("homepage.index.government_activity", locale: :en) | ||
} %> | ||
<% end %> | ||
</ul> | ||
</section> | ||
</div> | ||
|
||
<div class="govuk-grid-column-full govuk-grid-column-one-third-from-desktop"> | ||
<section class="homepage-section homepage-section__departments-organisations"> | ||
<div class="homepage-section__heading"> | ||
<div class="govuk-grid-column-full govuk-grid-column-two-thirds-from-desktop" data-module="gem-track-click ga4-link-tracker"> | ||
<section class="homepage-section homepage-section__government-activity"> | ||
<div class="homepage-section__heading"> | ||
<div class="homepage-section__heading-wrapper"> | ||
<%= render "govuk_publishing_components/components/heading", { | ||
font_size: "m", | ||
text: t("homepage.index.departments_and_organisations"), | ||
text: t("homepage.index.government_activity"), | ||
data_attributes: { | ||
ga4_scroll_marker: true, | ||
}, | ||
} %> | ||
</div> | ||
|
||
<%# | ||
The "big number" component links below are hardcoded separately (i.e. not in a loop in this instance) and therefore their 'index' properties are also hardcoded. If a new "big number" component is added or removed, this will need to be reflected in the 'index_link' and 'index_total' properties to ensure that they remain accurate for tracking/analytics purposes. | ||
%> | ||
<div class="homepage-section__depts" data-module="gem-track-click ga4-link-tracker"> | ||
<%= render "govuk_publishing_components/components/big_number", { | ||
number: t("homepage.index.ministerial_departments_count"), | ||
label: t("homepage.index.ministerial_departments"), | ||
href: "/government/organisations#ministerial_departments", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
"track-category": "homepageClicked", | ||
"track-action": "departmentsLink", | ||
"track-label": "/government/organisations#ministerial_departments", | ||
"track-dimension": "#{t("homepage.index.ministerial_departments_count")} #{t("homepage.index.ministerial_departments")}", | ||
"track-dimension-index": 29, | ||
"track-value": 1, | ||
"ga4_link": { | ||
"event_name": "navigation", | ||
"type": "homepage", | ||
"index": { | ||
"index_section": 4, | ||
"index_link": 1, | ||
"index_section_count": 6, | ||
}, | ||
"index_total": 2, | ||
"section": t("homepage.index.departments_and_organisations", locale: :en), | ||
"text": "#{t("homepage.index.ministerial_departments_count")} #{t("homepage.index.ministerial_departments", locale: :en)}" | ||
} | ||
}, | ||
} %> | ||
<%= render "govuk_publishing_components/components/big_number", { | ||
number: t("homepage.index.other_agencies_count"), | ||
label: t("homepage.index.other_agencies"), | ||
href: "/government/organisations#agencies_and_other_public_bodies", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
"track-category": "homepageClicked", | ||
"track-action": "departmentsLink", | ||
"track-label": "/government/organisations#agencies_and_other_public_bodies", | ||
"track-dimension": "#{t("homepage.index.other_agencies_count")} #{t("homepage.index.other_agencies")}", | ||
"track-dimension-index": 29, | ||
"track-value": 1, | ||
"ga4_link": { | ||
"event_name": "navigation", | ||
"type": "homepage", | ||
"index": { | ||
"index_section": 4, | ||
"index_link": 2, | ||
"index_section_count": 6, | ||
}, | ||
"index_total": 2, | ||
"section": t("homepage.index.departments_and_organisations", locale: :en), | ||
"text": "#{t("homepage.index.other_agencies_count")} #{t("homepage.index.other_agencies", locale: :en)}" | ||
} | ||
<%= render "govuk_publishing_components/components/lead_paragraph", { | ||
text: t("homepage.index.government_activity_description"), | ||
margin_bottom: 0 | ||
} %> | ||
</div> | ||
|
||
<ul class="homepage-services-and-info__list"> | ||
<% t("homepage.government_activity").each_with_index do | item, index | %> | ||
<%= render partial: "homepage/chevron_card", locals: { | ||
description: item[:description], | ||
link: item[:link], | ||
title: item[:title], | ||
track_action: "governmentactivityLink", | ||
index_values: { | ||
index_section: locals[:index_section], | ||
index_link: index + 1, | ||
index_section_count: locals[:index_section_count], | ||
}, | ||
index_total: t("homepage.government_activity").length, | ||
section: t("homepage.index.government_activity", locale: :en) | ||
} %> | ||
</div> | ||
</section> | ||
</div> | ||
<% end %> | ||
</ul> | ||
</section> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,48 @@ | ||
<%# | ||
Before updating a promotion slot please read the documentation. | ||
See: https://docs.publishing.service.gov.uk/repos/frontend/update-homepage-promotion-slots.html | ||
<% | ||
# Before updating a promotion slot please read the documentation. | ||
# See: https://docs.publishing.service.gov.uk/repos/frontend/update-homepage-promotion-slots.html | ||
%> | ||
|
||
<section class="homepage-section homepage-section--promotion-slots"> | ||
<%= render "govuk_publishing_components/components/heading", { | ||
text: t("homepage.index.featured"), | ||
font_size: "m", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
ga4_scroll_marker: true, | ||
<%= render "govuk_publishing_components/components/heading", { | ||
text: t("homepage.index.featured"), | ||
font_size: "m", | ||
margin_bottom: 6, | ||
data_attributes: { | ||
ga4_scroll_marker: true, | ||
}, | ||
} %> | ||
|
||
<% t("homepage.index.promotion_slots").each_with_index do | item, index | %> | ||
<%= render "govuk_publishing_components/components/image_card", { | ||
href: item[:href], | ||
href_data_attributes: { | ||
track_category: "homepageClicked", | ||
track_action: "promoLink", | ||
track_label: item[:href], | ||
track_value: "1", | ||
track_dimension_index: "29", | ||
track_dimension: item[:title], | ||
ga4_link: { | ||
event_name: 'navigation', | ||
type: 'homepage', | ||
index_section: locals[:index_section], | ||
index_link: index + 1, | ||
index_section_count: locals[:index_section_count], | ||
index_total: t("homepage.index.promotion_slots").length, | ||
section: t("homepage.index.featured", locale: :en) | ||
} | ||
}, | ||
image_src: image_path(item[:image_src]), | ||
image_alt: "", | ||
image_loading: "lazy", | ||
heading_level: 3, | ||
heading_text: item[:title], | ||
two_thirds: true, | ||
description: item[:text], | ||
font_size: "s", | ||
sizes: "(max-width: 640px) 100vw, (max-width: 1020px) 33vw, 300px", | ||
srcset: item.fetch(:srcset, {}).stringify_keys.transform_keys { |k| image_path(k) }.presence | ||
} %> | ||
|
||
<% t("homepage.index.promotion_slots").each_with_index do | item, index | %> | ||
<%= render "govuk_publishing_components/components/image_card", { | ||
href: item[:href], | ||
href_data_attributes: { | ||
track_category: "homepageClicked", | ||
track_action: "promoLink", | ||
track_label: item[:href], | ||
track_value: "1", | ||
track_dimension_index: "29", | ||
track_dimension: item[:title], | ||
ga4_link: { | ||
event_name: 'navigation', | ||
type: 'homepage', | ||
index: { | ||
index_section: 5, | ||
index_link: index + 1, | ||
index_section_count: 6, | ||
}, | ||
index_total: t("homepage.index.promotion_slots").length, | ||
section: t("homepage.index.featured", locale: :en) | ||
} | ||
}, | ||
image_src: image_path(item[:image_src]), | ||
image_alt: "", | ||
image_loading: "lazy", | ||
heading_level: 3, | ||
heading_text: item[:title], | ||
two_thirds: true, | ||
description: item[:text], | ||
font_size: "s", | ||
sizes: "(max-width: 640px) 100vw, (max-width: 1020px) 33vw, 300px", | ||
srcset: item.fetch(:srcset, {}).stringify_keys.transform_keys { |k| image_path(k) }.presence | ||
} %> | ||
<% end %> | ||
<% end %> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.