Skip to content

Commit

Permalink
Merge pull request #432 from MetaMask/add-home-portfolio-cta-experiment
Browse files Browse the repository at this point in the history
feat: add home portfolio cta experiment
  • Loading branch information
blaiseup authored Oct 7, 2024
2 parents f02a888 + 3967f51 commit c701737
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/components/CTA.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,16 @@ const CTA = props => {
setUseTextTreatment(value === 'treatment')
}

const init = async () => {

// Clean up with portfolio experiment
const EXPERIMENT_FLAG_NAMES = ['home-portfolio-cta-test']

if (!EXPERIMENT_FLAG_NAMES.includes(flagName)) {
const initHomePortfolioCTAExperiment = async () => {
if (!flagName?.startsWith('mm-portfolio-cta')) {
return
}
const value = await getLaunchDarklyFlag(flagName)
const value = await getLaunchDarklyFlag('home-portfolio-cta-test')
setUseTextTreatment(value === 'treatment')
}

init()
initMetaMaskDownloadCTAExperiment()
initHomePortfolioCTAExperiment()
}, [getLaunchDarklyFlag, setUseTextTreatment, flagName])

const [link, setLink] = React.useState(ctaLink)
Expand All @@ -143,20 +139,20 @@ const CTA = props => {
if (flagName === 'mm-download-cta-header') {
const currentPath = removeLanguageCode(location?.pathname)
if (currentPath === '/') {
ldClient?.track('home-header-download-cta-click')
ldClient?.track('home-header-portfolio-cta-click')
ldClient?.flush()
}
}

if (flagName === 'home-portfolio-cta-test') {
ldClient?.track('home-portfolio-cta-click')
if (flagName === 'mm-portfolio-cta-home-hero') {
ldClient?.track('home-hero-portfolio-cta-click')
ldClient?.flush()
}

if (flagName === 'navbar-view-portfolio-cta') {
if (flagName === 'mm-portfolio-cta-header') {
const currentPath = removeLanguageCode(location?.pathname)
if (currentPath === '/') {
ldClient?.track('navbar-view-portfolio-cta-click')
ldClient?.track('home-header-portfolio-cta-click')
ldClient?.flush()
}
}
Expand Down

0 comments on commit c701737

Please sign in to comment.