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.
rizdaprasetya commentedSep 14, 2020
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
historyrouterMode:With Google Analytics plugin enabled
Check the Codesandbox example on the bottom, to see some demo.
What is current behaviour
Due to this line:
docsify/src/plugins/ga.js
Lines 27 to 28 in c2d12ed
On history routerMode, the
location.hashvalue 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 uselocation.hashor not.Other relevant information
ref to Google analytics for SPA guide:
https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
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!🚀
The text was updated successfully, but these errors were encountered: