Skip to content

Commit 1931bcd

Browse files
committed
Add tracking for the notification
1 parent fea609e commit 1931bcd

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

packages/app/src/app/overmind/onInitialize.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { convertTypeToStatus } from '@codesandbox/common/lib/utils/notifications';
1+
import { NotificationStatus } from '@codesandbox/notifications';
22
import { OnInitialize } from '.';
33

44
export const onInitialize: OnInitialize = async (
@@ -109,12 +109,13 @@ export const onInitialize: OnInitialize = async (
109109

110110
// show terms message on first visit since new terms
111111
if (!effects.browser.storage.get(seenTermsKey) && !state.isFirstVisit) {
112+
effects.analytics.track('Saw Privacy Policy Notification');
112113
effects.notificationToast.add({
113114
message:
114115
'Hello, our privacy policy has been updated recently. What’s new? CodeSandbox emails. Please read and reach out.',
115116
title: 'Updated Privacy',
116-
status: convertTypeToStatus('notice'),
117-
sticky: true,
117+
status: NotificationStatus.NOTICE,
118+
timeAlive: 20_000,
118119
actions: {
119120
primary: [
120121
{

packages/homepage/src/components/Toast/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable jsx-a11y/control-has-associated-label */
22
import React, { useState, useEffect } from 'react';
3+
import track from '@codesandbox/common/lib/utils/analytics';
34
import { Link } from 'gatsby';
45
import { AnimatePresence } from 'framer-motion';
56

@@ -10,8 +11,13 @@ const Privacy = () => {
1011
const [show, setShow] = useState(false);
1112

1213
useEffect(() => {
13-
setShow(!window.localStorage.getItem(key));
14-
window.localStorage.setItem(key, true);
14+
const hasSeen = !!window.localStorage.getItem(key);
15+
if (!hasSeen) {
16+
setShow(true);
17+
window.localStorage.setItem(key, true);
18+
19+
track('Saw Privacy Policy Notification');
20+
}
1521
}, []);
1622

1723
return (

0 commit comments

Comments
 (0)