File tree Expand file tree Collapse file tree
src/app/components/Premium Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,13 @@ import FeatureList, { FeatureId } from './FeatureList'
88import PriceSection from './PriceSection'
99import Testimonials from './Testimonials'
1010import DiscountBadge from './DiscountBadge'
11+ import Browser from 'webextension-polyfill'
12+
13+ async function incrOpenTimes ( ) {
14+ const { premiumModalOpenTimes = 0 } = await Browser . storage . sync . get ( 'premiumModalOpenTimes' )
15+ Browser . storage . sync . set ( { premiumModalOpenTimes : premiumModalOpenTimes + 1 } )
16+ return premiumModalOpenTimes + 1
17+ }
1118
1219interface Props {
1320 open : boolean
@@ -21,7 +28,9 @@ const PremiumModal: FC<Props> = (props) => {
2128
2229 useEffect ( ( ) => {
2330 if ( props . open ) {
24- trackEvent ( 'show_premium_modal' , { source : props . feature } )
31+ incrOpenTimes ( ) . then ( ( openTimes ) => {
32+ trackEvent ( 'show_premium_modal' , { source : props . feature , openTimes } )
33+ } )
2534 }
2635 } , [ props . open , props . feature ] )
2736
You can’t perform that action at this time.
0 commit comments