I did something that does that when people land on my page for the first time, they get a JavaScript redirection to the same page, but with PHP $_GET
URL queries, then this page redirect back to the page without these queries, so the server got the screen's size of the client during this process.
The thing is that this redirection is done in JavaScript client-side, so I wonder if it could hurt my website's SEO in some ways (continue reading).
Here are solutions that I think could be good, but I'm not sure about what to do and what will happen if I do that. I don’t really know how Google scan sites, so I may be wrong:
Should I put this JavaScript redirect at the bottom of my page's code, so Google will have the time to scan my entire page before being redirected?
Should I put this JavaScript code in the
<head>
of the page so that there will be no waiting before the redirect is done, so human clients will be satisfied to not have to wait some milliseconds more, but Google will scan the second page instead of the first, or will incompletely scan the first?Should I detect with PHP whether or not I should echo this JavaScript code based on the type of the visitor (human or not). If this is what I should do, how to do it simply?
This is important, as this JavaScript code is on each page and is echoed in PHP each time someone (or a robot) visits the site for the first time.