vacu / electron-google-analytics Goto Github PK
View Code? Open in Web Editor NEWNode/Electron module for Google Analytics Measurement Protocol.
License: MIT License
Node/Electron module for Google Analytics Measurement Protocol.
License: MIT License
The lib seems not to work for me. I checked the test file and it passed with no matter TRACKING_ID is. When I passed random string for the TRACKING_ID, the test still passes, no requests got failed, which is super weird.
I tried passing the UA-... id from my G.A and make some event requests, nothing happened.
While working on the PR to convert this repo to typescript, I found a few things that perhaps could be improved.
For instance:
lib
to .gitignoreglobalBaseURL
and globalCollectURL
globalBatchURL
is unused. Should it be used or removed?Hi everyone. I'm using
const Analytics = require('electron-google-analytics');
const analytics = new Analytics.default('UA-87670043-6');
analytics.set('uid', 123);
and I'm getting this error:
analytics.set is not a function
What am i doing wrong?
Thank you!!!
Hello, I am using electron-google-analytics
in my Electron app that also uses React, Redux and Parcel. The electron-google-analytics
instance is initialized using a "web + app" property, so it uses a Measurement ID starting with G-
instead of a Tracking ID starting with UA-
.
When I try to send any data to Google Analytics, such as analytics.screen()
or analytics.event()
, the response returned from calling the function is
SyntaxError: Unexpected token o in JSON at position 1
Where did I go wrong?
Additionally, when I use a Tracking ID instead of a Measurement ID, the same error occurs but at least the events are being recorded by Google Analytics. However, events logged using analytics.screen()
does not appear to show up anywhere in the Google Analytics app. Does this module not work with Measurement IDs?
Thank you!
const analytics = new Analytics('G-XXXXXXXXXX');
analytics.set('clientID', state.user.clientId);
analytics.set('uid', state.user.uid);
analytics.set('appName', appName);
analytics.set('appVersion', appVersion);
// Intentionally passing these strings to `analytics.screen()`
const response = await analytics.screen('appName', 'appVersion', 'appId', 'appInstallerId', 'location.pathname');
console.log(response);
gives the following error in the electron app JS console
SyntaxError: Unexpected token o in JSON at position 1
at index.js:591
System Environment
I can't import this. There are no typings. It would be really awesome if you added typings or how to install them to the docs. All commands are for typescript and then typings installation is missing. Really a bummer.
It will be nice to have ability to send custom params.
Current api:
Analytics#event(evCategory, evAction, { evLabel, evValue, clientID })
Proposition to add one more way (raw data):
Analytics.event({
sr: '800x600',
ul: 'en-US',
av: '1.1.1',
...
})
const Analytics = require('electron-google-analytics');
const analytics = new Analytics('----');
https://support.google.com/analytics/answer/11583528
Any plan to update this package to align with change?
Hi,
The documentation doesn't specify the how and which tracking id should I create to start using google analytics
what tracking id should I create for electron app? I can only create tracking id for a website or a mobile app.
can you please explain?
When installing/updating electron-google-analytics
using yarn
, I get the warning messages:
warning electron-google-analytics > @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
warning electron-google-analytics > @babel/polyfill > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
Can package.json
be updated to address these warnings please? I am curently on [email protected]
. Thank you!
Hello,
I wanted to use Google Analytics 4 in my electron app, but it seems that because file://
protocol I can not use it as expected.
Proposed solution:
one of the solutions can be UA-XXXX id can be replaced with GA-XXXXX to let developers use Google Analytics measurement ID instead of Universal Analytics Id.
More information can be found here.
When you are tracking events using the suggested code examples, such as:
GA.pageview('ApplicationName', '/' + path, path, clientId);
The page views will never be tracked. You have to explicitly set the fourth parameter sessDuration
as undefined
, like so:
GA.pageview('ApplicationName', '/' + path, path, undefined, clientId);
Then all pageviews will be tracked properly. We experienced a major metrics issue due to this.
Great work, was curious if there was any documentation or functionality for using custom dimensions when sending events or pageviews, or setting a custom dimension for the user or session.
Thanks!
Hello @vacu ,
I found this project very interesting due to the fact that it's main focused is for electron apps.
I loved electron and I built one named productivity-timer which is an open source too.
I used universal-analytics for my project.
I want to try this library too but the problem is the typescript support.
Do you have a plan to support typescript too?
Thank you for any response.
like
ga('set', 'userId', 'USER_ID');
Hey!
Love your module so far but I have a problem with session basically each time I run analytics.pageview(), a user ID is regenerated and I get one new user in google analytics.
Meaning it is not possible to know how many people are using the app and that's a problem! :(
Any way we could fix that?
--Etienne
UPDATE: my bad.. I did not see the
"If you want to keep the session you need to specify the clientID."
haha! All good then!
Thanks again for your work! Your rock! 👍 💯
I have this error after I tried to use "analytics.screen" method without debug mode:
Uncaught SyntaxError: Unexpected token G in JSON at position 0
Response body is:
GIF89a�������,����D�;
So I think we need to check for this before you are doing JSON.parse(body).
Please take a look at screenshot:
https://www.dropbox.com/s/kreklzlktc34bwo/Screenshot%202017-02-23%2012.25.00.png?dl=0
When using this module the seassion duration in GA dashboard is always 0. How do I fix it? I only use pageview in each screen. My Electron app is a single page app built mostly with React.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.