Skip to content

Commit

Permalink
Merge pull request #6834 from alphagov/remove-ua
Browse files Browse the repository at this point in the history
Remove Universal Analytics
  • Loading branch information
AshGDS authored Jul 5, 2024
2 parents 4a5cc9d + 393dfd0 commit 60fc3f2
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 551 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
//= require govuk_publishing_components/components/radio
//= require govuk_publishing_components/components/step-by-step-nav
//= require govuk_publishing_components/components/table
//= require modules/track-responses
107 changes: 0 additions & 107 deletions app/assets/javascripts/modules/track-responses.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
description: benefit["description"],
url: benefit["url"],
url_text: benefit["url_text"],
url_track_action: "Cost of living results"
} %>
<% end %>
</div>
Expand Down
8 changes: 0 additions & 8 deletions app/presenters/question_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ def response_label(value)
value
end

def change_link_track_label(value)
if redacted?
"#{title} / [FILTERED]"
else
"#{title} / #{response_label(value)}"
end
end

def partial_template_name
"#{@node.class.name.demodulize.underscore}_question"
end
Expand Down
8 changes: 2 additions & 6 deletions app/views/components/_result_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
description ||= nil
url ||= nil
url_text ||= nil
url_track_action ||= nil

if !title || !url || !url_text || !url_track_action
raise ArgumentError, "The result card component requires a title, url, url_text and url_track_action"
if !title || !url || !url_text
raise ArgumentError, "The result card component requires a title, url, and url_text"
end
%>
<div class="app-c-result-card">
Expand All @@ -26,9 +25,6 @@
<%= link_to url_text, url,
class: "govuk-link app-c-result-card__link",
data: {
"track-category": "SmartAnswerClicked",
"track-action": url_track_action,
"track-label": url,
"ga4-ecommerce-path": url.delete_prefix("https://www.gov.uk")
} %>
</div>
8 changes: 1 addition & 7 deletions app/views/components/_result_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
<%= link_to (title + " (opens in new tab)" if title.present?), url,
class: "govuk-link",
target: "_blank",
rel: "noreferrer noopener",
data: {
module: "gem-track-click",
"track-action": "#{group_index}.#{result_index}",
"track-category": "SmartAnswerClicked",
"track-label": url
} %>
rel: "noreferrer noopener" %>
</h4>
<p class="govuk-body govuk-!-margin-bottom-1">
<%= description %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/components/docs/result_card.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ examples:
description: You may be able to get up to £2,000 a year for each of your children to help with the costs of childcare.
url: /tax-free-childcare
url_text: Check if you’re eligible for Tax-Free childcare
url_track_action: Cost of living results
no_description:
data:
title: Tax-Free childcare
url: /tax-free-childcare
url_text: Check if you’re eligible for Tax-Free childcare
url_track_action: Cost of living results
8 changes: 1 addition & 7 deletions app/views/smart_answers/custom_result.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@
<%= tag.p class: "govuk-body govuk-!-margin-bottom-8" do %>
<%= link_to "Answer the questions again to change the results",
restart_flow_path(@presenter),
class: "govuk-link",
data: {
module: "gem-track-click",
"track-action": "Answer the questions again to change the results",
"track-category": "StartAgain",
"track-label": @presenter.current_node.title
} %>
class: "govuk-link" %>
<% end %>

<%= render 'govuk_publishing_components/components/print_link' %>
Expand Down
11 changes: 2 additions & 9 deletions app/views/smart_answers/custom_result_full_width.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
<div
id="result-info"
class="outcome"
data-module="auto-track-event ga4-auto-tracker"
data-track-category="Smart Answer"
data-track-action="Completed"
data-track-label="<%= @name %>"
data-track-options='{"nonInteraction": true}'
data-module="ga4-auto-tracker"
data-ga4-auto="<%={
"event_name": "form_complete",
"type": "smart answer",
Expand All @@ -43,9 +39,7 @@

<div
data-flow-name="<%= @name %>"
data-module="gem-track-click ga4-link-tracker"
data-track-category="Internal Link Clicked"
data-track-action="<%= @name %> results"
data-module="ga4-link-tracker"
data-ga4-link="<%= {
"event_name": "information_click",
"type": "smart answer",
Expand All @@ -55,7 +49,6 @@
}.to_json %>"
data-ga4-track-links-only
data-ga4-set-indexes
data-track-links-only
>
<div class="govuk-!-margin-bottom-6">
<% if outcome.title.present? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/smart_answers/question.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<%= form_tag(current_question_path(@presenter),
:method => :get,
:data => {
module: "track-responses ga4-form-tracker",
module: "ga4-form-tracker",
type: question.partial_template_name,
ga4_form: ga4_attributes,
"question-key": question.node_slug,
Expand Down
13 changes: 2 additions & 11 deletions app/views/smart_answers/result.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@
<div
id="result-info"
class="govuk-grid-column-two-thirds outcome"
data-module="auto-track-event ga4-auto-tracker ga4-smart-answer-results-tracker"
data-track-category="Smart Answer"
data-track-action="Completed"
data-track-label="<%= @name %>"
data-track-options='{"nonInteraction": true}'
data-module="ga4-auto-tracker ga4-smart-answer-results-tracker"
data-ga4-auto="<%= {
"event_name": "form_complete",
"type": "smart answer",
"section": title,
"action": "complete",
"tool_name": @presenter.title
}.to_json %>"
data-ecommerce-start-index="1"
data-list-title="<%= @presenter.title %>"
data-ga4-ecommerce-start-index="1"
data-ga4-list-title="<%= @presenter.title %>"
>
Expand All @@ -45,9 +39,7 @@

<div
data-flow-name="<%= @name %>"
data-module="gem-track-click ga4-link-tracker"
data-track-category="Internal Link Clicked"
data-track-action="<%= @name %> results"
data-module="ga4-link-tracker"
data-ga4-link="<%= {
"event_name": "information_click",
"type": "smart answer",
Expand All @@ -57,7 +49,6 @@
}.to_json %>"
data-ga4-track-links-only
data-ga4-set-indexes
data-track-links-only
>
<div class="govuk-!-margin-bottom-6">
<% if outcome.title.present? %>
Expand Down
10 changes: 2 additions & 8 deletions app/views/smart_answers/shared/_previous_answers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
restart_flow_path(@presenter),
class: "govuk-link",
data: {
module: "gem-track-click ga4-link-tracker",
"track-action": "Start again",
"track-category": "StartAgain",
"track-label": @presenter.current_node.title,
module: "ga4-link-tracker",
ga4_link: {
event_name: "form_start_again",
type: "smart answer",
Expand All @@ -41,10 +38,7 @@
edit: {
href: @presenter.change_answer_link(question, response_store.forwarding_responses),
data_attributes: {
"module": "gem-track-click ga4-link-tracker",
"track-category": "Smart Answer Change Link",
"track-action": "Link clicked",
"track-label": question.change_link_track_label(accepted_response),
"module": "ga4-link-tracker",
ga4_link: {
event_name: "form_change_response",
type: "smart answer",
Expand Down
28 changes: 0 additions & 28 deletions docs/debugging/custom-google-analytics-tracking-id.md

This file was deleted.

10 changes: 10 additions & 0 deletions spec/javascripts/dummy-test.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* We want to keep the jasmine/standardx functionality for tests in this repo, however they both crash if no JS spec files exist.
* Therefore we can keep this dummy test in. It can be removed if real tests are written for something in the future.
*/

describe('dummy test', function () {
it('accepts the truth', function () {
expect(true).toBe(true)
})
})
Loading

0 comments on commit 60fc3f2

Please sign in to comment.