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

[PAY-2089] Add analytics events for users opening rewards claim modal #6486

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/common/src/models/Analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ export enum Name {
REWARDS_CLAIM_HCAPTCHA = 'Rewards Claim: Hcaptcha',
REWARDS_CLAIM_REJECTION = 'Rewards Claim: Rejection',
REWARDS_CLAIM_UNKNOWN = 'Rewards Claim: Unknown',
REWARDS_CLAIM_DETAILS_OPENED = 'Rewards Claim: Details Opened',

// Tipping
TIP_AUDIO_REQUEST = 'Tip Audio: Request',
Expand Down Expand Up @@ -1391,6 +1392,11 @@ type RewardsClaimUnknown = {
error: string
}

type RewardsClaimDetailsOpened = {
eventName: Name.REWARDS_CLAIM_DETAILS_OPENED
challengeId: string
}

export type TipSource =
| 'profile'
| 'feed'
Expand Down Expand Up @@ -2007,6 +2013,7 @@ export type AllTrackingEvents =
| RewardsClaimFailure
| RewardsClaimRejection
| RewardsClaimUnknown
| RewardsClaimDetailsOpened
| TipAudioRequest
| TipAudioSuccess
| TipAudioFailure
Expand Down
15 changes: 13 additions & 2 deletions packages/mobile/src/screens/audio-screen/ChallengeRewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import {
modalsActions,
makeOptimisticChallengeSortComparator,
FeatureFlags,
ChallengeName
ChallengeName,
Name
} from '@audius/common'
import { useFocusEffect } from '@react-navigation/native'
import { View } from 'react-native'
import { useDispatch, useSelector } from 'react-redux'

import LoadingSpinner from 'app/components/loading-spinner'
import { useFeatureFlag, useRemoteVar } from 'app/hooks/useRemoteConfig'
import { make, track } from 'app/services/analytics'
import { makeStyles } from 'app/styles'
import { getChallengeConfig } from 'app/utils/challenges'

Expand Down Expand Up @@ -119,11 +121,20 @@ export const ChallengeRewards = () => {
.sort(makeOptimisticChallengeSortComparator(optimisticUserChallenges))
.map((id) => {
const props = getChallengeConfig(id)
const onPress = () => {
openModal(id)
track(
make({
eventName: Name.REWARDS_CLAIM_DETAILS_OPENED,
challengeId: id
})
)
}
return (
<Panel
{...props}
challenge={optimisticUserChallenges[id]}
onPress={() => openModal(id)}
onPress={onPress}
key={props.title}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
ChallengeName,
audioRewardsPageSelectors,
isAudioMatchingChallenge,
makeOptimisticChallengeSortComparator
makeOptimisticChallengeSortComparator,
Name
} from '@audius/common'
import {
ProgressBar,
Expand All @@ -31,6 +32,7 @@ import { Text } from 'components/typography'
import { useIsAudioMatchingChallengesEnabled } from 'hooks/useIsAudioMatchingChallengesEnabled'
import { useRemoteVar } from 'hooks/useRemoteConfig'
import { useWithMobileStyle } from 'hooks/useWithMobileStyle'
import { make, track } from 'services/analytics'

import styles from './RewardsTile.module.css'
import { Tile } from './components/ExplainerTile'
Expand Down Expand Up @@ -75,7 +77,12 @@ const RewardPanel = ({
const wm = useWithMobileStyle(styles.mobile)
const userChallenges = useSelector(getOptimisticUserChallenges)

const openRewardModal = () => openModal(id)
const openRewardModal = () => {
openModal(id)
track(
make({ eventName: Name.REWARDS_CLAIM_DETAILS_OPENED, challengeId: id })
)
}

const challenge = userChallenges[id]
const shouldShowCompleted =
Expand Down