mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-20 18:09:51 +00:00
add analytics event for lbry:// links
This commit is contained in:
parent
d1807f4fcf
commit
801e285260
2 changed files with 7 additions and 1 deletions
|
@ -22,6 +22,7 @@ type Analytics = {
|
||||||
rewardEligibleEvent: () => void,
|
rewardEligibleEvent: () => void,
|
||||||
startupEvent: () => void,
|
startupEvent: () => void,
|
||||||
readyEvent: number => void,
|
readyEvent: number => void,
|
||||||
|
openUrlEvent: string => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
type LogPublishParams = {
|
type LogPublishParams = {
|
||||||
|
@ -124,6 +125,9 @@ const analytics: Analytics = {
|
||||||
rewardEligibleEvent: () => {
|
rewardEligibleEvent: () => {
|
||||||
sendGaEvent('Engagement', 'Reward-Eligible');
|
sendGaEvent('Engagement', 'Reward-Eligible');
|
||||||
},
|
},
|
||||||
|
openUrlEvent: (url: string) => {
|
||||||
|
sendGaEvent('Engagement', 'Open-Url', url);
|
||||||
|
},
|
||||||
startupEvent: () => {
|
startupEvent: () => {
|
||||||
sendGaEvent('Startup', 'Startup');
|
sendGaEvent('Startup', 'Startup');
|
||||||
},
|
},
|
||||||
|
@ -133,11 +137,12 @@ const analytics: Analytics = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function sendGaEvent(category, action) {
|
function sendGaEvent(category, action, label) {
|
||||||
if (analyticsEnabled && isProduction) {
|
if (analyticsEnabled && isProduction) {
|
||||||
ReactGA.event({
|
ReactGA.event({
|
||||||
category,
|
category,
|
||||||
action,
|
action,
|
||||||
|
...(label ? { label } : {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,7 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
||||||
} else if (isURIValid(uri)) {
|
} else if (isURIValid(uri)) {
|
||||||
const formattedUri = formatLbryUriForWeb(uri);
|
const formattedUri = formatLbryUriForWeb(uri);
|
||||||
app.store.dispatch(push(formattedUri));
|
app.store.dispatch(push(formattedUri));
|
||||||
|
analytics.openUrlEvent(formattedUri);
|
||||||
} else {
|
} else {
|
||||||
app.store.dispatch(
|
app.store.dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
|
|
Loading…
Add table
Reference in a new issue