-
Notifications
You must be signed in to change notification settings - Fork 311
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
WV-??? Add Source Object into GTM logic SearchBar2024.jsx [CHANGES NEEDED] #4266
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @seanquinn917! 👍
@@ -73,6 +73,11 @@ class SearchBar2024 extends Component { | |||
const dataLayerObject = { | |||
event: 'searchKeyword', | |||
searchKeyword: searchString, | |||
source:{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to source
to pageDetails
.
pageName: window.location.href, | ||
pageType: "challenge", | ||
pathName: window.location.pathname, | ||
}, | ||
user:{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update user
to userDetails
.
@@ -73,6 +73,11 @@ class SearchBar2024 extends Component { | |||
const dataLayerObject = { | |||
event: 'searchKeyword', | |||
searchKeyword: searchString, | |||
source:{ | |||
pageName: window.location.href, | |||
pageType: "challenge", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the pageName & pageType to come from the parent component that calls searchBar20204
, but instead of adding props we need to pass from the parent, I think another approach will be more maintainable. Please create a function in /js/utils/calculateGTMPageType.js
which takes in the pathName, and returns one of our pageTypes:
ballot, politician, candidate, donation, homepage, ballot, account, challenge, issue
...and then an even more specific pageName. Feel free to reach out with questions!
Update SearchBar2024.jsx GTM logic to include updated 'source' object.