Analyze sessions with logrocket
This commit is contained in:
parent
604988c352
commit
692eb36f50
|
@ -42,6 +42,7 @@
|
|||
"howler": "^2.1.2",
|
||||
"html-loader": "^0.5.5",
|
||||
"ignore-loader": "^0.1.2",
|
||||
"logrocket": "^1.0.7",
|
||||
"lz-string": "^1.4.4",
|
||||
"markdown-loader": "^4.0.0",
|
||||
"obfuscator-loader": "^1.1.2",
|
||||
|
|
|
@ -18,6 +18,36 @@ if (window.coreThreadLoadedCb) {
|
|||
window.coreThreadLoadedCb();
|
||||
}
|
||||
|
||||
if (!G_IS_DEV && !G_IS_STANDALONE) {
|
||||
const monthlyUsers = 300; // thousand
|
||||
const logrocketLimit = 10; // thousand
|
||||
const percentageOfUsers = logrocketLimit / monthlyUsers;
|
||||
|
||||
if (Math.random() <= percentageOfUsers) {
|
||||
logger.log("Analyzing this session with logrocket");
|
||||
const logrocket = require("logrocket");
|
||||
logrocket.init("p1x9zh/shapezio");
|
||||
|
||||
try {
|
||||
logrocket.getSessionURL(function (sessionURL) {
|
||||
logger.log("Connected lockrocket to GA");
|
||||
// @ts-ignore
|
||||
try {
|
||||
window.ga("send", {
|
||||
hitType: "event",
|
||||
eventCategory: "LogRocket",
|
||||
eventAction: sessionURL,
|
||||
});
|
||||
} catch (ex) {
|
||||
logger.warn("Logrocket connection to analytics failed:", ex);
|
||||
}
|
||||
});
|
||||
} catch (ex) {
|
||||
logger.warn("Logrocket connection to analytics failed:", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
`%cshapez.io ️%c\n© 2020 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(
|
||||
G_BUILD_TIME
|
||||
|
|
|
@ -5604,6 +5604,11 @@ logalot@^2.0.0, logalot@^2.1.0:
|
|||
figures "^1.3.5"
|
||||
squeak "^1.0.0"
|
||||
|
||||
logrocket@^1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/logrocket/-/logrocket-1.0.7.tgz#fe17dbdfc861481cd274fbda533d552de7800a3a"
|
||||
integrity sha512-v6HWEQIsyG+3FkldB7vIAgHh7/qpsiz2Br4bLK5SHBvjqRrHs/Fp+Jr8oiA2GYq0UurAtCu51U8SWft5+OCKtg==
|
||||
|
||||
longest@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
|
||||
|
|
Loading…
Reference in New Issue