Description
Bug Report
Wrong page path/url value being sent by Docsify's Google Analytics plugins if config used is routerMode: "history"
.
Steps to reproduce
run/deploy docsify with the following config of history
routerMode:
window.$docsify = {
routerMode: 'history'
};
With Google Analytics plugin enabled
Check the Codesandbox example on the bottom, to see some demo.
What is current behaviour
Due to this line:
Lines 27 to 28 in c2d12ed
On history routerMode, the location.hash
value is always empty string ""
.
No matter which page visitor open, the value being sent as page is always empty string.
What is the expected behaviour
On history routerMode, the value of third param of window.ga('set', 'page', currentPageValue);
should be the proper path of the current page opened by visitor.
Maybe first check what is the value of routerMode
, then determine wether to use location.hash
or not.
Other relevant information
ref to Google analytics for SPA guide:
https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
- Your OS: Mac OS, any OS really.
- Node.js version: any
- npm/yarn version: any
- Browser version: any
- Docsify version: any
- Docsify plugins: Google Analytics
Please create a reproducible sandbox
Mention the docsify version in which this bug was not present (if any)
none
Anyway thanks for this amazing project! 🚀