Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop redacting dates in GA4 tracking on GOVUK search pages #4223

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

AshGDS
Copy link
Contributor

@AshGDS AshGDS commented Sep 13, 2024

What / Why

  • Removes date redaction from the standardiseSearchTerm function, - this function ensures the search term tracks the same across multiple parameters, so dates should no longer be redacted wherever we grab a search term.
  • Also removes date redaction from the location, query_string, and search_term values in the PageView tracker.
  • The PAs have requested this, as some of the filters use dates, and I believe there was a discussion at some point about dates being useful for search tracking. https://trello.com/c/RYSxnFZ1/841-remove-date-redaction-from-search-terms.

Visual Changes

None.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 11:28 Inactive
@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from d83e414 to 7d808b4 Compare September 13, 2024 11:29
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 11:30 Inactive
@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from 7d808b4 to 1d4af5b Compare September 13, 2024 11:41
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 11:42 Inactive
@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from 1d4af5b to a40c8a6 Compare September 13, 2024 11:51
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 11:51 Inactive
@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from a40c8a6 to 5da9980 Compare September 13, 2024 13:15
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 13:15 Inactive
@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from 5da9980 to 20528f7 Compare September 13, 2024 13:24
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 13, 2024 13:24 Inactive
@AshGDS AshGDS marked this pull request as ready for review September 13, 2024 13:46
@AshGDS AshGDS requested a review from andysellick September 13, 2024 13:46
Copy link
Contributor

@andysellick andysellick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one non-blocking small suggestion.

@@ -78,7 +78,9 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
},

getLocation: function () {
return this.PIIRemover.stripPIIWithOverride(this.stripGaParam(document.location.href), true, true)
// We don't want to remove dates on search pages.
var stripDates = !this.getSearchTerm()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line gets repeated later - would it be possible to store this value on initialisation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andysellick - good point, i've changed it so that it's only called once. Are you able to re-review?

@AshGDS AshGDS force-pushed the ga4-search-date-redaction branch from 20528f7 to 5975578 Compare September 17, 2024 13:37
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4223 September 17, 2024 13:37 Inactive
@AshGDS AshGDS merged commit 6321786 into main Sep 17, 2024
12 checks passed
@AshGDS AshGDS deleted the ga4-search-date-redaction branch September 17, 2024 13:50
csutter added a commit to alphagov/finder-frontend that referenced this pull request Sep 23, 2024
A recent change in `govuk_publishing_components` removed date redaction
from search term updates:
alphagov/govuk_publishing_components#4223

The GA4 finder tracking spec additionally tests this behaviour, so was
failing when the gem was bumped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants