update to initial analytics url
This commit is contained in:
parent
64ed191a9d
commit
5e38108e3d
3 changed files with 15 additions and 8 deletions
|
@ -6,6 +6,7 @@ import { history } from './store';
|
|||
// @if TARGET='app'
|
||||
import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
@ -253,7 +254,9 @@ analytics.pageView(window.location.pathname + window.location.search);
|
|||
// @if TARGET='app'
|
||||
ReactGA.set({ checkProtocolTask: null });
|
||||
ReactGA.set({ location: 'https://lbry.tv' });
|
||||
analytics.pageView(window.location.pathname.split('.html')[1] + window.location.search || '/');
|
||||
analytics.pageView(
|
||||
window.location.pathname.split('.html')[1] + window.location.search || generateInitialUrl(window.location.hash)
|
||||
);
|
||||
// @endif;
|
||||
|
||||
// Listen for url changes and report
|
||||
|
|
|
@ -14,6 +14,7 @@ import { buildSharedStateMiddleware, ACTIONS as LBRY_REDUX_ACTIONS } from 'lbry-
|
|||
import { doGetSync, selectUserVerifiedEmail } from 'lbryinc';
|
||||
import { getSavedPassword } from 'util/saved-passwords';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
|
@ -96,14 +97,8 @@ const persistOptions = {
|
|||
|
||||
let history;
|
||||
// @if TARGET='app'
|
||||
let initialEntry = '/';
|
||||
let hash = window.location.hash;
|
||||
if (hash) {
|
||||
hash = hash.replace('#', '');
|
||||
initialEntry = hash.startsWith('/') ? hash : '/' + hash;
|
||||
}
|
||||
history = createMemoryHistory({
|
||||
initialEntries: [initialEntry],
|
||||
initialEntries: [generateInitialUrl(window.location.hash)],
|
||||
initialIndex: 0,
|
||||
});
|
||||
// @endif
|
||||
|
|
|
@ -61,3 +61,12 @@ exports.formatWebUrlIntoLbryUrl = (pathname, search) => {
|
|||
|
||||
return appLink;
|
||||
};
|
||||
|
||||
exports.generateInitialUrl = hash => {
|
||||
let url = '/';
|
||||
if (hash) {
|
||||
hash = hash.replace('#', '');
|
||||
url = hash.startsWith('/') ? hash : '/' + hash;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue