mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 17:55:11 +00:00
fix for lbrytv analytics minus pb
This commit is contained in:
parent
c849c955bb
commit
eba1448b8a
1 changed files with 21 additions and 11 deletions
|
@ -12,6 +12,7 @@ const devInternalApis = process.env.LBRY_API_URL;
|
||||||
const LBRY_TV_MINUS_PIRATE_BAY_UA_ID = 'UA-60403362-16';
|
const LBRY_TV_MINUS_PIRATE_BAY_UA_ID = 'UA-60403362-16';
|
||||||
const LBRY_TV_UA_ID = 'UA-60403362-12';
|
const LBRY_TV_UA_ID = 'UA-60403362-12';
|
||||||
const DESKTOP_UA_ID = 'UA-60403362-13';
|
const DESKTOP_UA_ID = 'UA-60403362-13';
|
||||||
|
const SECOND_TRACKER_NAME = 'tracker2';
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
ElectronCookies.enable({
|
ElectronCookies.enable({
|
||||||
|
@ -45,7 +46,7 @@ let analyticsEnabled: boolean = true;
|
||||||
const analytics: Analytics = {
|
const analytics: Analytics = {
|
||||||
pageView: path => {
|
pageView: path => {
|
||||||
if (analyticsEnabled) {
|
if (analyticsEnabled) {
|
||||||
ReactGA.pageview(path);
|
ReactGA.pageview(path, [SECOND_TRACKER_NAME]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setUser: userId => {
|
setUser: userId => {
|
||||||
|
@ -148,21 +149,27 @@ const analytics: Analytics = {
|
||||||
|
|
||||||
function sendGaEvent(category, action, label) {
|
function sendGaEvent(category, action, label) {
|
||||||
if (analyticsEnabled && isProduction) {
|
if (analyticsEnabled && isProduction) {
|
||||||
ReactGA.event({
|
ReactGA.event(
|
||||||
|
{
|
||||||
category,
|
category,
|
||||||
action,
|
action,
|
||||||
...(label ? { label } : {}),
|
...(label ? { label } : {}),
|
||||||
});
|
},
|
||||||
|
[SECOND_TRACKER_NAME]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendGaTimingEvent(category: string, action: string, timeInMs: number) {
|
function sendGaTimingEvent(category: string, action: string, timeInMs: number) {
|
||||||
if (analyticsEnabled && isProduction) {
|
if (analyticsEnabled && isProduction) {
|
||||||
ReactGA.timing({
|
ReactGA.timing(
|
||||||
|
{
|
||||||
category,
|
category,
|
||||||
variable: action,
|
variable: action,
|
||||||
value: timeInMs,
|
value: timeInMs,
|
||||||
});
|
},
|
||||||
|
[SECOND_TRACKER_NAME]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +191,9 @@ if (!IS_WEB) {
|
||||||
if (!isPirateBayUser) {
|
if (!isPirateBayUser) {
|
||||||
gaTrackers.push({
|
gaTrackers.push({
|
||||||
trackingId: LBRY_TV_MINUS_PIRATE_BAY_UA_ID,
|
trackingId: LBRY_TV_MINUS_PIRATE_BAY_UA_ID,
|
||||||
|
gaOptions: {
|
||||||
|
name: SECOND_TRACKER_NAME,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue