-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Issue: No Data Received in GA Console with electron-google-analytics4
My Setup:
"electron-google-analytics4": "^1.2.0"
"electron": "^26.2.1"
"electron-builder": "^24.6.4"
"ts-node": "^10.9.1"
Code:
in main.ts:
import Analytics from 'electron-google-analytics4';
export var analytics = new Analytics('G-XXXXXXXX', '_XXXXXXXXX');
App.ts:
useEffect(() => {
if (window.electron && window.electron.ipcRenderer) {
console.log("sending to electron")
window.electron.ipcRenderer.sendMessage('google-analytics-4', 'page_view' );
}
}, []);
ipcHandlers.ts
ipcMain.on('google-analytics-4', async (evt, args) =>{
console.log("recieving in preload evt: "+ " param "+ args)
analytics.set('after auth', "afterAuth");
analytics.set('engagement_time_msec', 10);
analytics.set('test1', 1);
analytics.set('test2', 2);
analytics.event(args)
const response = await analytics.event(args);
const configData = JSON.parse(response?.config?.data);
console.log("response analytics configData"+JSON.stringify(configData))
console.log("response analytics status"+JSON.stringify(response?.status))
console.log("response analytics"+JSON.stringify(response?.data))
})
Console Output:
evt: param page_view
response analytics configData{"client_id":"XXXXXXXXXX","events":[{"name":"page_view","params":{"session_id":"XXXXX","after auth":"afterAuth","engagement_time_msec":10,"test1":1,"test2":2}}]}
response analytics status204
response analytics""
Issue Description:
Despite the setup and the code running without any apparent errors, no data is received in my Google Analytics console. The console logs indicate that the events are being sent, the status code is 204, and the response data is empty.
I'm probably missing something simple, but any help is appreciated. Thank you!
Metadata
Metadata
Assignees
Labels
No labels