Skip to content

Commit 5cc38ee

Browse files
authored
feat: track screen size for currents traces (#936)
1 parent 9fe79b7 commit 5cc38ee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

renderer/src/common/lib/analytics.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export function trackEvent(eventName: string, data = {}) {
88
attributes: {
99
'analytics.source': 'tracking',
1010
'analytics.type': 'event',
11+
'screen.width': window.innerWidth,
12+
'screen.height': window.innerHeight,
13+
'screen.aspect_ratio': (window.innerWidth / window.innerHeight).toFixed(
14+
2
15+
),
1116
...data,
1217
timestamp: new Date().toISOString(),
1318
},
@@ -26,6 +31,11 @@ export function trackPageView(pageName: string, data = {}) {
2631
'analytics.type': 'page_view',
2732
'page.name': pageName,
2833
'action.type': 'navigation',
34+
'screen.width': window.innerWidth,
35+
'screen.height': window.innerHeight,
36+
'screen.aspect_ratio': (window.innerWidth / window.innerHeight).toFixed(
37+
2
38+
),
2939
...data,
3040
timestamp: new Date().toISOString(),
3141
},

0 commit comments

Comments
 (0)