Skip to content

Commit 95aaacd

Browse files
committed
track the most used screen resolutions
1 parent 1c98690 commit 95aaacd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/utils/Analytics.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ const trackReposDateRangeChange = (dateRange) => {
6969
trackEvent('Repos', 'ChangeDateRange', dateRange)
7070
}
7171

72+
const getResolution = () => {
73+
const realWidth = window.screen.width
74+
const realHeight = window.screen.height
75+
return `${realWidth}x${realHeight}`
76+
}
77+
7278
const trackEvent = (category, action, label) => {
7379
if (!process.env.REACT_APP_ANALYTICS_ID) {
7480
console.log('Missing analytics ID')
@@ -93,6 +99,8 @@ const trackEvent = (category, action, label) => {
9399
['ua', navigator.userAgent],
94100
])
95101

102+
payload.append('sr', getResolution())
103+
96104
if (label) {
97105
payload.append('el', label.capitalize())
98106
}

0 commit comments

Comments
 (0)