umami icon indicating copy to clipboard operation
umami copied to clipboard

Get the full URL for "page" rather than the relative one

Open fullpwemium opened this issue 2 years ago • 3 comments

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?

fullpwemium avatar Mar 07 '22 12:03 fullpwemium

I'll have to look into it. But what is the use case for this?

mikecao avatar Mar 08 '22 00:03 mikecao

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?

fullpwemium avatar Mar 08 '22 04:03 fullpwemium

I'm not sure I understand. You want the full url in the referrer or the page, or both?

mikecao avatar Mar 18 '22 01:03 mikecao

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.

wihodges avatar Feb 23 '23 18:02 wihodges

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.

franciscao633 avatar Mar 06 '23 22:03 franciscao633