mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
send nudge source to matomo
This commit is contained in:
parent
64ea6e6adc
commit
92817203fc
1 changed files with 14 additions and 6 deletions
|
@ -95,11 +95,19 @@ const analytics: Analytics = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pageView: path => {
|
pageView: (path, search) => {
|
||||||
if (internalAnalyticsEnabled) {
|
if (internalAnalyticsEnabled) {
|
||||||
MatomoInstance.trackPageView({
|
const params = { href: `${path}` };
|
||||||
href: `${path}`,
|
const dimensions = [];
|
||||||
});
|
const searchParams = search && new URLSearchParams(search);
|
||||||
|
|
||||||
|
if (searchParams && searchParams.get('src')) {
|
||||||
|
dimensions.push({ id: 1, value: searchParams.get('src') });
|
||||||
|
}
|
||||||
|
if (dimensions.length) {
|
||||||
|
params['customDimensions'] = dimensions;
|
||||||
|
}
|
||||||
|
MatomoInstance.trackPageView(params);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setUser: userId => {
|
setUser: userId => {
|
||||||
|
@ -280,7 +288,7 @@ const MatomoInstance = new MatomoTracker({
|
||||||
// Manually call the first page view
|
// Manually call the first page view
|
||||||
// React Router doesn't include this on `history.listen`
|
// React Router doesn't include this on `history.listen`
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
analytics.pageView(window.location.pathname + window.location.search);
|
analytics.pageView(window.location.pathname + window.location.search, window.location.search);
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
|
@ -295,7 +303,7 @@ history.listen(location => {
|
||||||
const { pathname, search } = location;
|
const { pathname, search } = location;
|
||||||
|
|
||||||
const page = `${pathname}${search}`;
|
const page = `${pathname}${search}`;
|
||||||
analytics.pageView(page);
|
analytics.pageView(page, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default analytics;
|
export default analytics;
|
||||||
|
|
Loading…
Add table
Reference in a new issue