Skip to content

Commit 6158ddb

Browse files
committed
set user properties and log device info to GA4
1 parent a87f83d commit 6158ddb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

companion/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import log from './log'
99
import { timestamp } from '../common/utils'
1010
import { me as companion } from 'companion'
1111
import { device, app } from 'peer'
12-
import { GA4_MEASUREMENT_ID, GA4_MEASUREMENT_API_SECRET } from '../resources/config'
12+
import { GA4_MEASUREMENT_ID, GA4_MEASUREMENT_API_SECRET, VERSION } from '../resources/config'
1313
import { inbox } from 'file-transfer'
1414
import {
1515
sendDataToApp,
@@ -30,6 +30,18 @@ ga.configure({
3030
autoFileTransferProcessing: false,
3131
debug: false,
3232
})
33+
const deviceInfo = getDeviceInfo()
34+
deviceInfo.appVersion = VERSION
35+
ga.setUserProperties({
36+
appVersion: VERSION,
37+
osName: deviceInfo.osName,
38+
osVersion: deviceInfo.osVersion,
39+
modelName: deviceInfo.modelName,
40+
})
41+
ga.send({
42+
name: 'device_info',
43+
params: deviceInfo,
44+
})
3345

3446
function getDeviceInfo() {
3547
return {

0 commit comments

Comments
 (0)