Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
electron-google-analytics
Advanced tools
The main purpose of this was to be used with Electron built apps.
https://vacu.github.io/electron-google-analytics/
Installation
npm i electron-google-analytics
Init
Analytics(trackingID, { userAgent, debug, version })
import Analytics from 'electron-google-analytics';
const analytics = new Analytics('UA-XXXXXXXX-X');
Set (custom params)
Analytics#set(key, value)
analytics.set('uid', 123);
Remove parameter:
analytics.set('uid', null);
Pageview
Analytics#pageview(hostname, url, title, clientID, sessionDuration)
return analytics.pageview('http://example.com', '/home', 'Example')
.then((response) => {
return response;
}).catch((err) => {
return err;
});
If you want to keep the session you need to specify the clientID
. The clientID
can be found in the promise response
above.
Event
Analytics#event(evCategory, evAction, { evLabel, evValue, clientID })
return analytics.event('Video', 'play', { evLabel: 'holiday', evValue: 300})
.then((response) => {
return response;
}).catch((err) => {
return err;
});
Screenview
Analytics#screen(appName, appVer, appID, appInstallerID, screenName, clientID)
return analytics.screen('test', '1.0.0', 'com.app.test', 'com.app.installer', 'Test')
.then((response) => {
return response;
}).catch((err) => {
return err;
});
Transaction
Analytics#transaction(trnID, { trnAffil, trnRev, trnShip, trnTax, currCode } = {}, clientID)
return analytics.transaction(123).then((response) => {
return response;
}).catch((err) => {
return err;
});
Social
Analytics#social(socialAction, socialNetwork, socialTarget, clientID)
return analytics.social('like', 'facebook', 'home').then((response) => {
return response;
}).catch((err) => {
return err;
});
Exception
Analytics#exception(exDesc, exFatal, clientID)
return analytics.exception('IOException', 1).then((response) => {
return response;
}).catch((err) => {
return err;
});
Refund
Analytics#refund(trnID, evCategory = 'Ecommerce', evAction = 'Refund', nonInteraction = 1, { prdID, prdQty } = {}, clientID)
return analytics.refund('T123').then((response) => {
return response;
}).catch((err) => {
return err;
});
Purchase
Analytics#purchase(hostname, url, title, transactionID, { trnAffil, trnRev, trnTax, trnShip, trnCoupon, prdID, prdName, prdCtg, prdBrand, prdVar, prdPos } = {}, clientID)
return analytics.purchase('http://example.com', '/test', 'Test', 'T123', { prdID: 'P123' }).then((response) => {
return response;
}).catch((err) => {
return err;
});
Checkout Steps
Analytics#checkout(hostname, url, title, checkoutStep, checkoutOpt, { prdID, prdName, prdCtg, prdBrand, prdVar, prdPrice, prdQty } = {}, clientID)
return analytics.checkout('http://example.com', '/test', 'Test', '1', 'Visa').then((response) => {
return response;
}).catch((err) => {
return err;
});
Checkout Options
Analytics#checkoutOpt(evCategory, evAction, checkoutStep, checkoutOpt, clientID)
return analytics.checkoutOpt('Checkout', 'Option', '2', 'FedEx').then((response) => {
return response;
}).catch((err) => {
return err;
});
Item
Analytics#item(trnID, itemName, { itemPrice, itemQty, itemSku, itemVariation, currCode } = {}, clientID)
return analytics.item(123, 'Test item').then((response) => {
return response;
}).catch((err) => {
return err;
});
User Timing Tracking
Analytics#timingTrk(timingCtg, timingVar, timingTime, { timingLbl, dns, pageDownTime, redirTime, tcpConnTime, serverResTime } = {}, clientID)
return analytics.timingTrk('Category', 'jsonLoader').then((response) => {
return response;
}).catch((err) => {
return err;
});
Send (for everything else for now)
Analytics#send(hitType, params, clientID)
return analytics.send('social', { sa: 'social', sn: 'facebook', st: 'home' })
.then((response) => {
return response;
}).catch((err) => {
return err;
});
If you are not using tools like babel to use es6 with your application, you'll have to modify your code slightly. Below is an example of a test screen view that you can use out of the box with node.js
const Analytics = require('electron-google-analytics');
const analytics = new Analytics.default('UA-XXXXXXXX-X');
function test(){
return analytics.screen('test', '1.0.0', 'com.app.test', 'com.app.installer', 'Test')
.then((response) => {
return response;
}).catch((err) => {
return err;
});
}
test();
cross-env TRACKING_ID='UA-XXXXXXXX-X' npm test
FAQs
A library to implement Google Analytics in desktop apps.
The npm package electron-google-analytics receives a total of 0 weekly downloads. As such, electron-google-analytics popularity was classified as not popular.
We found that electron-google-analytics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.