Skip to content

Commit

Permalink
Remove instances of ga4_tracking
Browse files Browse the repository at this point in the history
These were accidentally left in after moving to disable_ga4.
  • Loading branch information
AshGDS committed Oct 4, 2024
1 parent cc36130 commit a06a7ae
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 30 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* Update accessibility criteria in component docs ([PR #4242](https://github.com/alphagov/govuk_publishing_components/pull/4242))
* Show all big_number symbol types in our docs ([PR #4271](https://github.com/alphagov/govuk_publishing_components/pull/4271))
* Remove incorrect search component example ([PR #4253](https://github.com/alphagov/govuk_publishing_components/pull/4253))
* Add component wrapper to contextual guidance component ([PR #4282](https://github.com/alphagov/govuk_publishing_components/pull/4277))
* Add component wrapper to contextual guidance component ([PR #4277](https://github.com/alphagov/govuk_publishing_components/pull/4277))
* Center text and icons vertically in the option select component ([PR #4256](https://github.com/alphagov/govuk_publishing_components/pull/4256))
* Remove instances of ga4_tracking ([PR #4282](https://github.com/alphagov/govuk_publishing_components/pull/4282))

## 43.5.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ examples:
applicable: false
alternative_url: /
type: detailed_guide
ga4_tracking: true
disable_ga4: true
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ examples:
description: Disables GA4 tracking on tabs as links. Tracking is enabled by default.
data:
as_links: true
ga4_tracking: true
disable_ga4: true
tabs:
- href: "/page1"
label: "Link 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div class="govuk-width-container">
<%= render "govuk_publishing_components/components/phase_banner", {
phase: "beta",
ga4_tracking: true,
message: sanitize(t("components.layout_for_public.account_layout.feedback.banners.phase_banner_html"))
} unless omit_account_phase_banner %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ def sidebar
if show_sidebar?
@sidebar ||= current_step_nav.content.tap do |sb|
configure_for_sidebar(sb)
sb.merge!(small: true, heading_level: 3, tracking_id: current_step_nav.content_id, ga4_tracking: @query_parameters[:ga4_tracking])
sb.merge!(small: true, heading_level: 3, tracking_id: current_step_nav.content_id, disable_ga4: @query_parameters[:disable_ga4])
end
end
end

def header(ga4_tracking)
def header(disable_ga4)
if show_header?
{
title: current_step_nav.title,
path: current_step_nav.base_path,
tracking_id: current_step_nav.content_id,
ga4_tracking:,
disable_ga4:,
}
else
{}
Expand Down
3 changes: 1 addition & 2 deletions spec/components/intervention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ def component_name
assert_select ".gem-c-intervention .govuk-link", text: /Hide this suggestion/
end

it "renders the component with GA4 tracking when ga4_tracking is true" do
it "renders the component with GA4 tracking " do
render_component(
name: "test-campaign",
suggestion_text: "You might be interested in",
suggestion_link_text: "Travel abroad",
suggestion_link_url: "/travel-abroad",
dismiss_text: "Hide this suggestion",
ga4_tracking: true,
)

assert_select ".gem-c-intervention[data-ga4-intervention-banner]"
Expand Down
2 changes: 1 addition & 1 deletion spec/components/layout_super_navigation_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def component_name
end

it "adds GA4 tracking" do
render_component({ ga4_tracking: true })
render_component({})

assert_select "header[data-module='ga4-event-tracker ga4-link-tracker']"
assert_select "a[data-ga4-link]", count: 23
Expand Down
12 changes: 6 additions & 6 deletions spec/components/step_by_step_nav_related_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def two_links_with_tracking
assert_select "#{this_link}[data-ga4-link='#{expected.to_json}']", false
end

it "adds GA4 data attributes on multiple links when ga4_tracking is true" do
render_component(pretitle: "Some more text", links: two_links, ga4_tracking: true)
it "adds GA4 data attributes on multiple links" do
render_component(pretitle: "Some more text", links: two_links)

link_one = ".gem-c-step-nav-related .gem-c-step-nav-related__links .govuk-link[href='/link1']"
link_two = ".gem-c-step-nav-related .gem-c-step-nav-related__links .govuk-link[href='/link2']"
Expand All @@ -136,23 +136,23 @@ def two_links_with_tracking
assert_select "#{link_two}[data-ga4-link='#{expected_two.to_json}']"
end

it "does not add GA4 data attributes on multiple links when ga4_tracking is false" do
render_component(links: two_links, ga4_tracking: false)
it "does not add GA4 data attributes on multiple links when GA4 is disabled" do
render_component(links: two_links, disable_ga4: true)

link_one = ".gem-c-step-nav-related .gem-c-step-nav-related__links .govuk-link[href='/link1']"
link_two = ".gem-c-step-nav-related .gem-c-step-nav-related__links .govuk-link[href='/link2']"

expected_one = {
"event_name": "navigation",
"type": "related content",
"type": "part of",
"index_link": "1",
"index_total": "2",
"section": "Part of",
}

expected_two = {
"event_name": "navigation",
"type": "related content",
"type": "part of",
"index_link": "2",
"index_total": "2",
"section": "Part of",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@

it "handled gracefully" do
step_nav_links = described_class.new(content_store_response, "/giant-pool/planning")
ga4_tracking = true
disable_ga4 = true

expect(step_nav_links.step_navs.count).to eq(0)

expect(step_nav_links.show_header?).to be false
expect(step_nav_links.header(ga4_tracking)).to eq({})
expect(step_nav_links.header(disable_ga4)).to eq({})

expect(step_nav_links.show_related_links?).to be false
expect(step_nav_links.related_links).to eq([])
Expand All @@ -172,16 +172,16 @@

it "parses the content item" do
step_nav_links = described_class.new(content_store_response, "/vomit-comet-session")
ga4_tracking = true
disable_ga4 = true

expect(step_nav_links.step_navs.count).to eq(1)

expect(step_nav_links.show_header?).to be true
expect(step_nav_links.header(ga4_tracking)).to eq(
expect(step_nav_links.header(disable_ga4)).to eq(
path: "/learn-to-spacewalk",
title: "Learn to spacewalk: small step by giant leap",
tracking_id: "cccc-dddd",
ga4_tracking:,
disable_ga4:,
)

expect(step_nav_links.show_related_links?).to be true
Expand Down Expand Up @@ -506,19 +506,19 @@

it "parses the content item" do
step_nav_links = described_class.new(content_store_response, "/vomit-comet-session")
ga4_tracking = true
disable_ga4 = true

expect(step_nav_links.step_navs.count).to eq(0)
expect(step_nav_links.secondary_step_by_steps.count).to eq(1)

expect(step_nav_links.show_secondary_step_by_step?).to be true
expect(step_nav_links.show_related_links_for_secondary_step_by_steps?).to be true
expect(step_nav_links.show_header?).to be true
expect(step_nav_links.header(ga4_tracking)).to eq(
expect(step_nav_links.header(disable_ga4)).to eq(
path: "/lose-your-lunch",
title: "Lose your lunch: lurch by lurch",
tracking_id: "aaaa-bbbb",
ga4_tracking:,
disable_ga4:,
)

expect(step_nav_links.show_related_links?).to be true
Expand Down Expand Up @@ -611,19 +611,19 @@

it "parses the content item" do
step_nav_links = described_class.new(content_store_response, "/vomit-comet-session")
ga4_tracking = true
disable_ga4 = true

expect(step_nav_links.step_navs.count).to eq(1)
expect(step_nav_links.secondary_step_by_steps.count).to eq(1)

expect(step_nav_links.show_secondary_step_by_step?).to be false
expect(step_nav_links.show_related_links_for_secondary_step_by_steps?).to be false
expect(step_nav_links.show_header?).to be true
expect(step_nav_links.header(ga4_tracking)).to eq(
expect(step_nav_links.header(disable_ga4)).to eq(
path: "/PRIMARY-lose-your-lunch",
title: "PRIMARY Lose your lunch: lurch by lurch",
tracking_id: "PRIMARY-aaaa-bbbb",
ga4_tracking:,
disable_ga4:,
)

expect(step_nav_links.show_related_links?).to be true
Expand Down Expand Up @@ -661,19 +661,19 @@

it "parses the content item" do
step_nav_links = described_class.new(content_store_response, "/vomit-comet-session")
ga4_tracking = true
disable_ga4 = true

expect(step_nav_links.step_navs.count).to eq(1)
expect(step_nav_links.secondary_step_by_steps.count).to eq(2)

expect(step_nav_links.show_secondary_step_by_step?).to be false
expect(step_nav_links.show_related_links_for_secondary_step_by_steps?).to be false
expect(step_nav_links.show_header?).to be true
expect(step_nav_links.header(ga4_tracking)).to eq(
expect(step_nav_links.header(disable_ga4)).to eq(
path: "/PRIMARY-lose-your-lunch",
title: "PRIMARY Lose your lunch: lurch by lurch",
tracking_id: "PRIMARY-aaaa-bbbb",
ga4_tracking:,
disable_ga4:,
)

expect(step_nav_links.show_related_links?).to be true
Expand Down

0 comments on commit a06a7ae

Please sign in to comment.