From be8b82c6abf5b3b93b056f084227137e1dc01c06 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 8 Aug 2022 15:07:56 +0100 Subject: [PATCH 1/6] Add GA4 tracking for detailed guides --- .../content_items/detailed_guide.html.erb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index 3d8b35f7b..dc52bde90 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -105,6 +105,16 @@ <%= render "govuk_publishing_components/components/print_link", { margin_top: 0, margin_bottom: 6, + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 2, + section: 'Contents', + }, + }, } unless brexit_child_taxon %> <% if brexit_child_taxon %> @@ -122,6 +132,16 @@ <%= render "govuk_publishing_components/components/print_link", { margin_top: 0, margin_bottom: 6, + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 2, + index_total: 2, + section: 'Footer', + }, + }, } unless brexit_child_taxon %> <%= render 'shared/sidebar_navigation' %> From d7f5f3b06a7a7bd4ba8dc42a4095710d2a367770 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 8 Aug 2022 15:48:42 +0100 Subject: [PATCH 2/6] Add GA4 tracking for guides --- app/views/content_items/guide.html+print.erb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/views/content_items/guide.html+print.erb b/app/views/content_items/guide.html+print.erb index 25bc17063..d7b0b1255 100644 --- a/app/views/content_items/guide.html+print.erb +++ b/app/views/content_items/guide.html+print.erb @@ -7,7 +7,7 @@
- <%= render 'govuk_publishing_components/components/title', { + <%= render 'govuk_publishing_components/components/title', { margin_bottom: 6, title: @content_item.title, } %> @@ -21,10 +21,17 @@ <%= render 'govuk_publishing_components/components/print_link', { data_attributes: { + module: "ga4-event-tracker", "track-category": "printButton", "track-action": "clicked", "track-label": t("components.print_link.text"), - module: "print-link" + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 2, + section: 'Contents', + }, }, margin_bottom: 8, text: t("components.print_link.text"), @@ -45,10 +52,17 @@ <%= render 'govuk_publishing_components/components/print_link', { data_attributes: { + module: "ga4-event-tracker", "track-category": "printButton", "track-action": "clicked", "track-label": t("components.print_link.text"), - module: "print-link" + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 2, + index_total: 2, + section: 'Footer', + }, }, text: t("components.print_link.text") } %> From 34820028774c1bb8f79fa9aa215f80489bfb26e8 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 8 Aug 2022 16:13:23 +0100 Subject: [PATCH 3/6] Add GA4 tracking for HMRC manuals --- app/views/content_items/hmrc_manual.html.erb | 13 ++++++++++++- .../content_items/hmrc_manual_section.html.erb | 13 ++++++++++++- app/views/content_items/manuals/_updates.html.erb | 13 ++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/app/views/content_items/hmrc_manual.html.erb b/app/views/content_items/hmrc_manual.html.erb index 00144b78c..1b1368b0c 100644 --- a/app/views/content_items/hmrc_manual.html.erb +++ b/app/views/content_items/hmrc_manual.html.erb @@ -24,5 +24,16 @@
<% end %> - <%= render "govuk_publishing_components/components/print_link" %> + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Footer', + }, + }, + } %>
diff --git a/app/views/content_items/hmrc_manual_section.html.erb b/app/views/content_items/hmrc_manual_section.html.erb index 7f7683f76..390625ca6 100644 --- a/app/views/content_items/hmrc_manual_section.html.erb +++ b/app/views/content_items/hmrc_manual_section.html.erb @@ -45,5 +45,16 @@ - <%= render "govuk_publishing_components/components/print_link" %> + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Footer', + }, + }, + } %> diff --git a/app/views/content_items/manuals/_updates.html.erb b/app/views/content_items/manuals/_updates.html.erb index edef46a7d..552485208 100644 --- a/app/views/content_items/manuals/_updates.html.erb +++ b/app/views/content_items/manuals/_updates.html.erb @@ -70,4 +70,15 @@ -<%= render "govuk_publishing_components/components/print_link" %> +<%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Footer', + }, + }, +} %> From 193370ab31cc1affc9cb80e8896913018ebdeaff Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 8 Aug 2022 16:22:56 +0100 Subject: [PATCH 4/6] Add GA4 tracking for html publications --- app/views/content_items/html_publication.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index 622d08698..9ac484472 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -54,9 +54,20 @@ <% if @content_item.contents.any? %>
<%= render 'govuk_publishing_components/components/contents_list', contents: @content_item.contents, format_numbers: true %> - <%= render "govuk_publishing_components/components/print_link", { + + <%= render 'govuk_publishing_components/components/print_link', { margin_top: 0, margin_bottom: 6, + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Contents', + }, + }, } %>
<% end %> From dfdca9d421b49990f726625fb0399ee5e4b393a3 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Tue, 9 Aug 2022 08:55:14 +0100 Subject: [PATCH 5/6] Add GA4 tracking for manuals --- app/views/content_items/manual.html.erb | 13 ++++++++++++- app/views/content_items/manual_section.html.erb | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/views/content_items/manual.html.erb b/app/views/content_items/manual.html.erb index 9824a772e..b514cef96 100644 --- a/app/views/content_items/manual.html.erb +++ b/app/views/content_items/manual.html.erb @@ -33,5 +33,16 @@ } %> <% end %> - <%= render "govuk_publishing_components/components/print_link" %> + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Footer', + }, + }, + } %> diff --git a/app/views/content_items/manual_section.html.erb b/app/views/content_items/manual_section.html.erb index 052c2bfc5..4c78b81f9 100644 --- a/app/views/content_items/manual_section.html.erb +++ b/app/views/content_items/manual_section.html.erb @@ -96,5 +96,16 @@ - <%= render "govuk_publishing_components/components/print_link" %> + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + module: "ga4-event-tracker", + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 1, + section: 'Footer', + }, + }, + } %> From ec173c235a375e61f69537c2d0eeb5c6d250ed96 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Tue, 9 Aug 2022 09:15:01 +0100 Subject: [PATCH 6/6] Add GA4 tracking for travel advice --- .../content_items/travel_advice.html+print.erb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/views/content_items/travel_advice.html+print.erb b/app/views/content_items/travel_advice.html+print.erb index 0e3502bee..e0f3ab0ba 100644 --- a/app/views/content_items/travel_advice.html+print.erb +++ b/app/views/content_items/travel_advice.html+print.erb @@ -20,10 +20,17 @@ <%= render 'govuk_publishing_components/components/print_link', { data_attributes: { + module: "ga4-event-tracker", "track-category": "printButton", "track-action": "clicked", "track-label": t("components.print_link.text"), - module: "print-link" + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 1, + index_total: 2, + section: 'Contents', + }, }, margin_bottom: 8, text: t("components.print_link.text"), @@ -45,10 +52,17 @@ <%= render 'govuk_publishing_components/components/print_link', { data_attributes: { + module: "ga4-event-tracker", "track-category": "printButton", "track-action": "clicked", "track-label": t("components.print_link.text"), - module: "print-link" + ga4: { + event_name: 'print_page', + type: 'Print this page', + index: 2, + index_total: 2, + section: 'Footer', + }, }, text: t("components.print_link.text") } %>