Skip to content

Commit

Permalink
Merge pull request #3710 from alphagov/homepage-scroll-tracking
Browse files Browse the repository at this point in the history
Add scroll tracking to the homepage
  • Loading branch information
andysellick authored Jul 27, 2023
2 parents e45dcd6 + 8431f27 commit 2047e13
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/views/homepage/_government_activity.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<%= render "govuk_publishing_components/components/heading", {
font_size: "m",
text: t("homepage.index.government_activity"),
data_attributes: {
ga4_scroll_marker: true,
},
} %>
</div>

Expand Down Expand Up @@ -39,6 +42,9 @@
<%= render "govuk_publishing_components/components/heading", {
font_size: "m",
text: t("homepage.index.departments_and_organisations"),
data_attributes: {
ga4_scroll_marker: true,
},
} %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/homepage/_inverse_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<header class="homepage-inverse-header">
<div class="govuk-width-container">
<h1 class="homepage-inverse-header__title">
<h1 class="homepage-inverse-header__title" data-ga4-scroll-marker>
<%= t('homepage.index.intro_title.html') %>
</h1>
<p class="homepage-inverse-header__intro"><%= t('homepage.index.intro_html') %></p>
Expand Down
4 changes: 4 additions & 0 deletions app/views/homepage/_links_and_search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
font_size: "m",
margin_bottom: 4,
text: t("homepage.index.popular_links_heading"),
data_attributes: {
ga4_scroll_marker: true,
},
} %>
<ul class="homepage-most-viewed-list" data-module="gem-track-click ga4-link-tracker">
<% t("homepage.index.popular_links").each_with_index do | item, index | %>
Expand Down Expand Up @@ -61,6 +64,7 @@
track_label: "/search/all",
track_dimension_index: 29,
track_dimension: "Search GOV.UK",
ga4_scroll_marker: true,
},
} %>
</form>
Expand Down
3 changes: 3 additions & 0 deletions app/views/homepage/_more_on_govuk.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
text: t("homepage.index.more"),
margin_bottom: 6,
font_size: "m",
data_attributes: {
ga4_scroll_marker: true,
},
} %>
</div>
<ul class="homepage-most-active-list" data-module="gem-track-click ga4-link-tracker">
Expand Down
3 changes: 3 additions & 0 deletions app/views/homepage/_promotion-slots.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<%= render "govuk_publishing_components/components/heading", {
text: t("homepage.index.featured"),
font_size: "m",
data_attributes: {
ga4_scroll_marker: true,
},
} %>
</div>

Expand Down
3 changes: 3 additions & 0 deletions app/views/homepage/_services_and_information.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
heading_level: 2,
margin_bottom: 6,
text: t("homepage.index.services_and_information"),
data_attributes: {
ga4_scroll_marker: true,
},
} %>
</div>

Expand Down
1 change: 1 addition & 0 deletions app/views/homepage/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<% content_for :extra_headers do %>
<link rel="canonical" href="<%= Frontend.govuk_website_root + root_path %>">
<meta name="description" content="<%= t("homepage.index.meta_description") %>">
<meta name="govuk:scroll-tracker" content="" data-module="ga4-scroll-tracker" data-ga4-track-type="markers"/>
<% end %>
<% content_for :title, t("homepage.index.intro_title.text") %>
<% content_for :body_classes, "homepage" %><%# The `homepage` body class is required for emergency banner. %>
Expand Down

0 comments on commit 2047e13

Please sign in to comment.