Skip to content

Commit d9ec83b

Browse files
committed
Reuse existing identify logic
1 parent cc4ee2b commit d9ec83b

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

packages/homepage/src/pages/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { identify } from '@codesandbox/common/lib/utils/analytics';
23

34
import TitleAndMetaTags from '../components/TitleAndMetaTags';
45
import Layout, { WRAPPER_STYLING } from '../components/layout';
@@ -56,14 +57,6 @@ const Homepage = () => (
5657
</Layout>
5758
);
5859

59-
if (typeof window !== 'undefined') {
60-
window.addEventListener('load', () => {
61-
try {
62-
window.amplitude.identify('hero0420', 'A');
63-
} catch (e) {
64-
console.warn(e);
65-
}
66-
});
67-
}
60+
identify('hero0420', 'A');
6861

6962
export default Homepage;

packages/homepage/src/pages/index2.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { identify } from '@codesandbox/common/lib/utils/analytics';
23

34
import TitleAndMetaTags from '../components/TitleAndMetaTags';
45
import Layout, { WRAPPER_STYLING } from '../components/layout';
@@ -57,14 +58,6 @@ const Homepage = () => (
5758
</Layout>
5859
);
5960

60-
if (typeof window !== 'undefined') {
61-
window.addEventListener('load', () => {
62-
try {
63-
window.amplitude.identify('hero0420', 'B');
64-
} catch (e) {
65-
console.warn(e);
66-
}
67-
});
68-
}
61+
identify('hero0420', 'B');
6962

7063
export default Homepage;

0 commit comments

Comments
 (0)