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

WV-??? Add Source Object into GTM logic SearchBar2024.jsx [CHANGES NEEDED] #4266

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

seanquinn917
Copy link
Contributor

Update SearchBar2024.jsx GTM logic to include updated 'source' object.

Copy link
Member

@DaleMcGrew DaleMcGrew left a 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:{
Copy link
Member

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:{
Copy link
Member

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",
Copy link
Member

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!

@DaleMcGrew DaleMcGrew changed the title Add Source Object into GTM logic SearchBar2024.jsx WV-??? Add Source Object into GTM logic SearchBar2024.jsx [CHANGES NEEDED] Mar 1, 2025
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.

2 participants