Skip to content

Commit

Permalink
Merge pull request #3192 from alphagov/ga4-ecommerce-content-id
Browse files Browse the repository at this point in the history
Add data-ga4-ecommerce-content-id to search results
  • Loading branch information
AshGDS authored Oct 23, 2023
2 parents 04f9d6d + 700f35d commit 0e0116e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/presenters/search_result_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def structure_parts
def ga4_ecommerce_data(path)
{
ga4_ecommerce_path: path,
ga4_ecommerce_content_id: @document.content_id,
}
end

Expand Down
2 changes: 2 additions & 0 deletions spec/presenters/result_set_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
data_attributes: {
ecommerce_path: "/path/to/doc",
ga4_ecommerce_path: "/path/to/doc",
ga4_ecommerce_content_id: "content_id",
ecommerce_row: 1,
ecommerce_index: 1,
track_category: "navFinderLinkClicked",
Expand Down Expand Up @@ -203,6 +204,7 @@
description: "document_description",
data_attributes: {
ga4_ecommerce_path: "/path/to/doc",
ga4_ecommerce_content_id: "content_id",
},
},
metadata: {
Expand Down
2 changes: 2 additions & 0 deletions spec/presenters/search_result_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
description: "I am a document. I am full of words and that.",
data_attributes: {
ga4_ecommerce_path: link,
ga4_ecommerce_content_id: "content_id",
ecommerce_path: link,
ecommerce_row: 1,
ecommerce_index: 1,
Expand Down Expand Up @@ -108,6 +109,7 @@
description: "Part description",
data_attributes: {
ga4_ecommerce_path: "#{link}/part-path",
ga4_ecommerce_content_id: "content_id",
ecommerce_path: "#{link}/part-path",
ecommerce_row: 1,
ecommerce_index: 1,
Expand Down

0 comments on commit 0e0116e

Please sign in to comment.