Skip to content

Commit

Permalink
Merge pull request #3782 from alphagov/ga4-smart-answer-outcome-number
Browse files Browse the repository at this point in the history
Add outcome number to GA4 form_complete event
  • Loading branch information
AshGDS authored Oct 2, 2023
2 parents 4f2cf25 + 57386b0 commit 6521193
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/views/simple_smart_answers/_outcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
section: @flow_state.current_node.title,
action: "complete",
tool_name: publication.title,
text: outcome.slug
}.to_json
%>
<div
Expand Down
2 changes: 1 addition & 1 deletion test/integration/simple_smart_answers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class SimpleSmartAnswersTest < ActionDispatch::IntegrationTest
# Asserting that we have the right data attribtues to trigger the
# TrackSmartAnswer JavaScript module doesn't feel like enough, but it'll do.
assert page.has_selector?("[data-module='track-smart-answer ga4-auto-tracker'][data-smart-answer-node-type=outcome]")
assert page.has_selector?("[data-ga4-auto='{\"event_name\":\"form_complete\",\"type\":\"simple smart answer\",\"section\":\"Right, off you go.\",\"action\":\"complete\",\"tool_name\":\"The Bridge of Death\"}']")
assert page.has_selector?("[data-ga4-auto='{\"event_name\":\"form_complete\",\"type\":\"simple smart answer\",\"section\":\"Right, off you go.\",\"action\":\"complete\",\"tool_name\":\"The Bridge of Death\",\"text\":\"right-off-you-go\"}']")
assert page.has_selector?("[data-ga4-link='{\"event_name\":\"information_click\",\"type\":\"simple smart answer\",\"section\":\"Right, off you go.\",\"action\":\"information click\",\"tool_name\":\"The Bridge of Death\"}']")
assert page.has_selector?("[data-ga4-link='{\"event_name\":\"form_start_again\",\"type\":\"simple smart answer\",\"section\":\"Right, off you go.\",\"action\":\"start again\",\"tool_name\":\"The Bridge of Death\"}']")
assert page.has_selector?("[data-ga4-link='{\"event_name\":\"form_change_response\",\"type\":\"simple smart answer\",\"section\":\"What...is your name?\",\"action\":\"change response\",\"tool_name\":\"The Bridge of Death\"}']")
Expand Down

0 comments on commit 6521193

Please sign in to comment.