Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect referrer parameter in /api/send #2765

Closed
broscr opened this issue May 29, 2024 · 11 comments
Closed

Incorrect referrer parameter in /api/send #2765

broscr opened this issue May 29, 2024 · 11 comments
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@broscr
Copy link

broscr commented May 29, 2024

Describe the Bug

When redirecting from Google to a website, it was detected that the document. referrer was correct, but the referrer carried in the request sent by/API/send was incorrect, resulting in the source domain name being none in the monitoring data

Database

PostgreSQL

Relevant log output

No response

Which Umami version are you using? (if relevant)

2.11.3

Which browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

NodeJS v: 18.19.1 - NextJS v:12.0.7

@jungju
Copy link

jungju commented Jun 25, 2024

I am experiencing the same issue. I am also using Next.js.

@FabioGodoyy
Copy link

I'm facing a similar problem where the document.referrer is accurate, but the referrer passed in the /api/send request is incorrect, leading to the absence of the originating domain in the analytics data. My setup includes NodeJS v18.17.1 and NextJS v14.1.0. Has anyone found a workaround for this issue?

@fxck
Copy link

fxck commented Aug 13, 2024

Having the same problem, funnily enough, when I used a manually beautified version of the script.js it works properly.

edit: I'm gonna try the source script as well https://github.com/umami-software/umami/blob/master/src/tracker/index.js I'm thinking there has to be some problem with the minification process

edit2: ok, it's not a minification problem

image

something seems to be happening with currentRef inside the init() function, before calling init it still has the correct value, inside init it does not

it seems to have the correct value up until it actually goes through this condition

if (document.readyState === 'complete' && !initialized) {}

and funnilly enough if you read referrer !== hostname ? referrer : '' at the same point the value is already messed up, it still returns the correct referref value

image

edit3:

handlePush is the cuplrit, it changes the referrer before it has a chance to send the initial request

image image

@fxck
Copy link

fxck commented Aug 13, 2024

This should work as a temp fix https://gist.github.com/fxck/4f31c37eb9a6fbca09c39518c07e55e6 use at your own risk.

@obstkompost
Copy link

i think i have the same issue

@mikecao
Copy link
Collaborator

mikecao commented Aug 23, 2024

@fxck Can you open a PR with your changes?

@mikecao mikecao added the bug Something isn't working label Aug 23, 2024
@obstkompost
Copy link

it would be great, if this could be fixed in the next version

@fxck
Copy link

fxck commented Aug 23, 2024

@mikecao I could, but I didn't because I had to do some significant changes and hack around the way the script is initialized, including adding a little event queue. And I'm absolutely not sure that it won't break any other use cases. I would be the best if the person that wrote the script originally looked into my findings here and fixed it properly.

@mikecao mikecao added the fixed in dev Fixed in the dev branch label Aug 27, 2024
@mikecao
Copy link
Collaborator

mikecao commented Aug 27, 2024

This is now fixed in dev, 291c64f

Will get a release out soon.

@mikecao
Copy link
Collaborator

mikecao commented Aug 28, 2024

Fixed in v2.13.2.

@mikecao mikecao closed this as completed Aug 28, 2024
@andreagrandi
Copy link

andreagrandi commented Aug 30, 2024

Screenshot 2024-08-30 at 19 13 34

@mikecao I'm running the 2.13.2 version but as you can see from the screenshot I'm still experiencing this bug.
Note: I've updated the app yesterday and the data you see is only from today, so the bug is still present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

7 participants