mirror of https://github.com/status-im/fathom.git
Merge pull request #16 from da2x/patch-2
Let querySelector do all the work when finding canonical href
This commit is contained in:
commit
0bb0c1356b
|
@ -40,8 +40,8 @@ function trackPageview() {
|
|||
|
||||
// get the path or canonical
|
||||
var path = location.pathname + location.search;
|
||||
var canonical = document.querySelector('link[rel="canonical"]');
|
||||
if(canonical && canonical.href) {
|
||||
var canonical = document.querySelector('link[rel="canonical"][href]');
|
||||
if(canonical) {
|
||||
path = canonical.href.substring(canonical.href.indexOf('/', 7)) || '/';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue