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,
|
||||
startupEvent: () => void,
|
||||
readyEvent: number => void,
|
||||
openUrlEvent: string => void,
|
||||
};
|
||||
|
||||
type LogPublishParams = {
|
||||
|
@ -124,6 +125,9 @@ const analytics: Analytics = {
|
|||
rewardEligibleEvent: () => {
|
||||
sendGaEvent('Engagement', 'Reward-Eligible');
|
||||
},
|
||||
openUrlEvent: (url: string) => {
|
||||
sendGaEvent('Engagement', 'Open-Url', url);
|
||||
},
|
||||
startupEvent: () => {
|
||||
sendGaEvent('Startup', 'Startup');
|
||||
},
|
||||
|
@ -133,11 +137,12 @@ const analytics: Analytics = {
|
|||
},
|
||||
};
|
||||
|
||||
function sendGaEvent(category, action) {
|
||||
function sendGaEvent(category, action, label) {
|
||||
if (analyticsEnabled && isProduction) {
|
||||
ReactGA.event({
|
||||
category,
|
||||
action,
|
||||
...(label ? { label } : {}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
|||
} else if (isURIValid(uri)) {
|
||||
const formattedUri = formatLbryUriForWeb(uri);
|
||||
app.store.dispatch(push(formattedUri));
|
||||
analytics.openUrlEvent(formattedUri);
|
||||
} else {
|
||||
app.store.dispatch(
|
||||
doToast({
|
||||
|
|
Loading…
Reference in a new issue