Skip to content

Commit

Permalink
Phase banner enable GA4 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
andysellick committed Nov 15, 2023
1 parent 0bbdd61 commit 077cf96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ app_name ||= nil
phase ||= nil
message ||= nil
inverse ||= false
ga4_tracking ||= false
disable_ga4 ||= false

unless message.present?
if phase == "beta"
Expand All @@ -20,7 +20,7 @@ container_css_classes << "gem-c-phase-banner--inverse" if inverse

data_attributes = {}

if ga4_tracking
unless disable_ga4
data_attributes[:ga4_phase_banner] = phase
data_attributes[:module] = "ga4-link-tracker"
data_attributes[:ga4_track_links_only] = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ examples:
app_name: Skittles Maker
phase: beta
inverse: true
with_ga4_tracking:
without_ga4_tracking:
description: |
Enables GA4 tracking on the banner. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
data:
app_name: Skittles Maker
phase: beta
inverse: true
ga4_tracking: true
disable_ga4: true
4 changes: 2 additions & 2 deletions spec/components/phase_banner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def component_name
end

it "renders banner with ga4 attributes" do
render_component(phase: "beta", ga4_tracking: true)
render_component(phase: "beta")
assert_select ".gem-c-phase-banner[data-ga4-phase-banner=beta]"
assert_select ".gem-c-phase-banner[data-module=ga4-link-tracker]"
assert_select ".gem-c-phase-banner[data-ga4-track-links-only]"
Expand All @@ -51,7 +51,7 @@ def component_name
end

it "renders banner without ga4 attributes" do
render_component(phase: "beta", ga4_tracking: false)
render_component(phase: "beta", disable_ga4: true)
assert_select ".gem-c-phase-banner[data-ga4-phase-banner]", false
assert_select ".gem-c-phase-banner[data-module=ga4-link-tracker]", false
assert_select ".gem-c-phase-banner[data-ga4-track-links-only]", false
Expand Down

0 comments on commit 077cf96

Please sign in to comment.