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

Fix current user missing in Google Analytics #495

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

MrOrz
Copy link
Member

@MrOrz MrOrz commented Jul 11, 2022

The issue is found in 20220706 meeting

Currently on production, if the user is already logged in, starts their session on the landing page, and then goes to other pages, their user ID will not be sent in Google Analytics actions.

This is because

  • We push current user to Google Tag Manager in useCurrentUser's onCompleted callback
    image
  • Before this PR, landing page uses its own way to load user, and thus does not use useCurrentUser
  • Landing page loads all fields that is required by useCurrentUser, so that when user enters other page from landing page, useCurrentUser hook will not invoke new GraphQL queries, thus not calling onCompleted callback at all.

This PR fixes the issue by using useCurrentUser in landing page as well.

Screenshot

Before

CURRENT_USER is not pushed to dataLayer even after the user logs in on landing page
image

After

Can see that CURRENT_USER is pushed to dataLayer as expected.
image

which will push user id to gtm dataLayer properly
@MrOrz MrOrz self-assigned this Jul 11, 2022
@coveralls
Copy link

Coverage Status

Coverage remained the same at 75.605% when pulling 9cda373 on fix-current-user into eb4d12d on profile-filter-count.

@MrOrz MrOrz merged commit 29e679e into profile-filter-count Jul 13, 2022
@MrOrz MrOrz deleted the fix-current-user branch July 13, 2022 17:52
@MrOrz MrOrz restored the fix-current-user branch July 13, 2022 17:53
@MrOrz MrOrz mentioned this pull request Jul 13, 2022
MrOrz added a commit that referenced this pull request Jul 13, 2022
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.

None yet

2 participants