Skip to content

[WV 1097] Add dataLayer push for Share button on Ballot Page [FEEDBACK PROVIDED] #4381

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

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

Conversation

aayushi01shah
Copy link

[WV 1097] Add dataLayer for "Share" on Ballot Page

This implementation adds Google Tag Manager dataLayer tracking for share button clicks across different sharing contexts (ballot, candidate, measure, office, organization, etc.)

@aayushi01shah aayushi01shah changed the title [WV 1097] Add dataLayer push for Share button on Ballot Page [WV 1097] Add dataLayer push for Share button on Ballot Page [TEAM REVIEW] Jun 10, 2025
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.

This is a great start @aayushi01shah. Comments below. Can you also be prepared to demo this in today's meeting?

@@ -52,6 +54,42 @@ class ShareButtonDesktopTablet extends Component {
const googleCivicElectionId = 0;
let kindOfShare = 'BALLOT';
let whatAndHowMuchToShare;

// Add debug logging
console.log('Share button clicked');
Copy link
Member

Choose a reason for hiding this comment

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

Hi @aayushi01shah I think this block should go after line 107 after kindOfShare and whatAndHowMuchToShare have been calculated. For the destinationDetails, we should use pathnameWithModalShare for the destinationPathname.
I would also recommend adding all of the various pathnameWithModalShare paths into lookupPageNameAndPageTypeDict so we can specify the destinationPageName and destinationPageType there.

voterWeVoteId: VoterStore.getVoterWeVoteId(),
},
shareDetails: {
kindOfShare,
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to also capture whatAndHowMuchToShare in this shareDetails dictionary.

const page = lookupPageNameAndPageTypeDict(currentPathname);

const dataLayerObject = {
event: 'shareClick',
Copy link
Member

Choose a reason for hiding this comment

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

event should be 'action'. Please also add actionDetails, which would include the id of the button clicked ("shareButtonDesktopTablet") -- BUT I think we should adjust this id to include the kind of share (ex/ candidateShare, officeShare, etc.):

      actionDetails: {
        actionType: 'openModal',
        buttonId: <ADD BUTTON ID HERE>,
      },

@DaleMcGrew DaleMcGrew changed the title [WV 1097] Add dataLayer push for Share button on Ballot Page [TEAM REVIEW] [WV 1097] Add dataLayer push for Share button on Ballot Page [FEEDBACK PROVIDED] Jun 10, 2025
@aayushi01shah aayushi01shah force-pushed the WV-1097-add-datalayer-share-ballot branch from 965ff12 to 909cf80 Compare June 10, 2025 22:28
@aayushi01shah aayushi01shah reopened this Jun 10, 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