Open korbinzhao opened 1 year ago
The default value for clientID is node machine id. Any thoughts on using it in the main process?
The default value for clientID is node machine id. Any thoughts on using it in the main process?
Thx for your response. I did use electron-google-analytics4 in a wrong place. It works now when I using it in the main process. Thx a lot.
But now I encountered a new problem as below.
(node:33013) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 172.217.163.36:443
I pinged the google-analytics.com in my local terminal, and reproduced this problem as below.
PING google-analytics.com (172.217.163.36): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3
I can request google-analytics.com success in my local browser.
Do you encountered this problem? It will be a large help for me if you can give me some suggestions.
Waiting for you response. Thx a lot again.
In another way, I can request google-analytics.com successful in renderer, but timeout in main process. It bothered me a lot. I have tried many ways to solve it, but just useless.
It could be a firewall or DNS configuration issue. There are several approaches you can try, and I hope they prove helpful.
Google Public DNS
instead.sudo dscacheutil -flushcache
I'll attach an issue that seems similar to yours. I hope it proves helpful. Web server is working, but ping returns a request timeout
@hajeonghun Thanks a lot for you response. I was able to fix the request problem in an unexpected way. At first I tried request GA API using axios, but it always timeout, looked like network blocked. Now I switched from using axios as my request tool to using fetch and disabled the webSecurity parameter in BrowserWindow. This enabled me to request the google-analytics.com API in the renderer process. It might also work for the main process, but I haven't tested it yet. I believe that there might have been some internal logic in axios that caused this issue.
@korbinzhao Congratulations, and thank you for sharing your situation. It will surely be helpful to others.
@korbinzhao sorry how did you solve the process is not defined issue? I am using electron and vite
I am using in electron renderer, error as below: