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

feat: Track "Social Login" campaign #251

Merged
merged 3 commits into from
Nov 22, 2023
Merged

Conversation

DiogoSoaress
Copy link
Member

What it solves

Adds tracking to the "Social Login" campaign page according to the shared doc

How this PR fixes it

  • Creates an util function to fire a GA4 event
  • Uses the tracking function when clicking the elements defined in the documentation

Notes

I could only test the events were being received in our analytics dashboard by modifying useGa.ts locally. This hook initializes ReactGA4.

Copy link

github-actions bot commented Nov 22, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Nov 22, 2023

Branch preview

✅ Deployed to dev:

https://safe-web-landing.dev.5afe.dev

@DiogoSoaress DiogoSoaress marked this pull request as ready for review November 22, 2023 12:49
Copy link
Member

@katspaugh katspaugh 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, much simpler than GTM.

import ReactGA from 'react-ga4'
import type { UaEventOptions } from 'react-ga4/types/ga4'

export const trackEvent = (eventData: UaEventOptions | string) => {
Copy link
Member

Choose a reason for hiding this comment

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

When can it be a string tho?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I've copied it over from the types definition file but we don't use it as a string ever. Removed it.

@DiogoSoaress DiogoSoaress merged commit b855a97 into main Nov 22, 2023
5 checks passed
@DiogoSoaress DiogoSoaress deleted the add-campaign-tracking branch November 22, 2023 17:34
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants