segmentio / analytics.js-core

The hassle-free way to integrate analytics into any web application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Protocol and domain are missed with canonical url

aleksei-a-savitski opened this issue · comments

If canonical URL is present it's value is used as context.page.url value.
Unlike window.location.href or href attribute of <a> tag, canonical tag doesn't convert absolute or relative path to fully qualified url.
For example for <link rel="canonical" href="/absolute/path" /> returned value will be "/absolute/path".
In such case, it's not possible to guess protocol and domain from an event data.

Sorry for the delay. I think I'd prefer to leave the canonical URL untouched here - that could cause more confusion down the line.

One thing we're considering here is to skip using the canonical URL by default and giving folks the option to use window.location.href instead.