Skip to content

Commit

Permalink
Merge pull request #6756 from alphagov/ga4-json-fix
Browse files Browse the repository at this point in the history
Ensure double quotes are used for GA4 JSON
  • Loading branch information
AshGDS committed Apr 19, 2024
2 parents 0df23a5 + 9b393c7 commit 19bae70
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions app/views/smart_answers/custom_result.html.erb
Expand Up @@ -19,13 +19,13 @@
<div
class="govuk-grid-column-two-thirds"
data-module="ga4-auto-tracker"
data-ga4-auto='{
data-ga4-auto="<%= {
"event_name": "form_complete",
"type": "smart answer",
"section": "<%= outcome.title %>",
"section": outcome.title,
"action": "complete",
"tool_name": "<%= @presenter.title %>"
}'
"tool_name": @presenter.title
}.to_json %>"
>
<%= render "govuk_publishing_components/components/title", {
title: outcome.title,
Expand Down
18 changes: 9 additions & 9 deletions app/views/smart_answers/custom_result_full_width.erb
Expand Up @@ -26,13 +26,13 @@
data-track-action="Completed"
data-track-label="<%= @name %>"
data-track-options='{"nonInteraction": true}'
data-ga4-auto='{
data-ga4-auto="<%={
"event_name": "form_complete",
"type": "smart answer",
"section": "<%= title %>",
"section": title,
"action": "complete",
"tool_name": "<%= @presenter.title %>"
}'
"tool_name": @presenter.title
}.to_json %>"
>
<%= render 'smart_answers/shared/debug' %>
<%= render "govuk_publishing_components/components/title", {
Expand All @@ -46,13 +46,13 @@
data-module="gem-track-click ga4-link-tracker"
data-track-category="Internal Link Clicked"
data-track-action="<%= @name %> results"
data-ga4-link='{
"event_name": "information_click",
data-ga4-link="<%= {
"event_name": "information_click",
"type": "smart answer",
"section": "<%= title %>",
"section": title,
"action": "information_click",
"tool_name": "<%= @presenter.title %>"
}'
"tool_name": @presenter.title
}.to_json %>"
data-ga4-track-links-only
data-ga4-set-indexes
data-track-links-only
Expand Down
22 changes: 11 additions & 11 deletions app/views/smart_answers/result.html.erb
Expand Up @@ -24,13 +24,13 @@
data-track-action="Completed"
data-track-label="<%= @name %>"
data-track-options='{"nonInteraction": true}'
data-ga4-auto='{
data-ga4-auto="<%= {
"event_name": "form_complete",
"type": "smart answer",
"section": "<%= title %>",
"section": title,
"action": "complete",
"tool_name": "<%= @presenter.title %>"
}'
"tool_name": @presenter.title
}.to_json %>"
data-ecommerce-start-index="1"
data-list-title="<%= @presenter.title %>"
data-ga4-ecommerce-start-index="1"
Expand All @@ -48,13 +48,13 @@
data-module="gem-track-click ga4-link-tracker"
data-track-category="Internal Link Clicked"
data-track-action="<%= @name %> results"
data-ga4-link='{
"event_name": "information_click",
"type": "smart answer",
"section": "<%= title %>",
"action": "information click",
"tool_name": "<%= @presenter.title %>"
}'
data-ga4-link="<%= {
"event_name": "information_click",
"type": "smart answer",
"section": title,
"action": "information click",
"tool_name": @presenter.title
}.to_json %>"
data-ga4-track-links-only
data-ga4-set-indexes
data-track-links-only
Expand Down

0 comments on commit 19bae70

Please sign in to comment.