#32613 - Add mixpanel tracking on upgrade modal and the recent model used
Showing
1 changed file
with
25 additions
and
0 deletions
| ... | @@ -251,6 +251,31 @@ function App() { | ... | @@ -251,6 +251,31 @@ function App() { |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | } | 253 | } |
| 254 | |||
| 255 | useEffect(() => { | ||
| 256 | const element = document.querySelector('#modal-container #modal-cta') | ||
| 257 | |||
| 258 | const handleMixpanel = () => { | ||
| 259 | if (window.mixpanel) { | ||
| 260 | window.mixpanel.track('chatbot-plus-upgrade-modal', { | ||
| 261 | 'click-location': 'upgrade-modal', | ||
| 262 | 'upgrade': currentModel | ||
| 263 | }); | ||
| 264 | } | ||
| 265 | } | ||
| 266 | |||
| 267 | if (element) { | ||
| 268 | element.addEventListener('click', handleMixpanel) | ||
| 269 | } | ||
| 270 | |||
| 271 | return () => { | ||
| 272 | if (element) { | ||
| 273 | element.removeEventListener('click', handleMixpanel) | ||
| 274 | } | ||
| 275 | } | ||
| 276 | }, [currentModel]) | ||
| 277 | |||
| 278 | |||
| 254 | const [startedInteraction, setStartedInteraction] = useState(false); | 279 | const [startedInteraction, setStartedInteraction] = useState(false); |
| 255 | return ( | 280 | return ( |
| 256 | <div className="App"> | 281 | <div className="App"> | ... | ... |
-
Please register or sign in to post a comment