umami
umami copied to clipboard
Get the full URL for "page" rather than the relative one
Hi,
Umami is great. I use it to track usage of my script by others, but it only returns the relative page location e.g. /article/something
. Is it possible to instead get https://example.com/article/something
?
I'll have to look into it. But what is the use case for this?
I'll have to look into it. But what is the use case for this?
Thank you for the quick reply.
My current use case for this is that I allow users to embed something into their own web pages and I'd like to collect analytics on where it's being used and whose driving the most traffic. I'm currently getting around this by using trackView
and setting the referrer to the window location, i.e. umami.trackView(window.location.href, window.location.href);
Unfortunately, this means I lose the actual referrer information! It would be great to be able to set an attribute, e.g. script.setAttribute('preserve_url', true)
, to keep the full url only when required. This way the default behaviour would continue to be optimal w.r.t. storage?
I'm not sure I understand. You want the full url in the referrer or the page, or both?
Yes, having the full url instead of just the path is helpful when the umami script is loaded on entire web domain including subdomains. It's also useful for making sure development/staging urls aren't polluting the data.
it seems possible to implement this through an env variable. The tracker script intently strips the domain, so we can just add conditional logic. I'll move to ideas discussion for the time being where our team reviews.