Googlebot seeing desktop version of site instead of mobilel
Mar 16, 2018 3:06 am by natastna2
Mar 16, 2018 3:06 am by natastna2
Hello,
I have Gtranslate enterprise for multiple websites and I'm having a strange issue in that a large number of our mobile pages have recently popped up as not mobile friendly. Upon testing this it appears that when using a foreign language, googlebot is seeing the desktop version of our page rather than the mobile version (when fetching as googlebot smartphone).
I am unsure as to how to go about fixing this and would appreciate any help.
Thank you for your time.
Regards,
Anthony
Re: Googlebot seeing desktop version of site instead of mobi
Mar 17, 2018 3:07 am by natastna2
Mar 17, 2018 3:07 am by natastna2
Hello,
I think I've narrowed it down a bit. The issue appears to be that the mobile template is used / switched to depending on the visitors user_agent and when I output the user_agent and then fetch the page I get Google seeing the user_agent as "Gtranslate translation proxy".
Is there a way of outputting the "real" user-agent? I've tried http_x_user_agent but that does not seem to work.
Any help would be greatly appreciated.
Thank you for your time.
Re: Googlebot seeing desktop version of site instead of mobi
Mar 18, 2018 11:11 pm by natastna2
Mar 18, 2018 11:11 pm by natastna2
Hello,
I ended up solving this. There's nothing more annoying than coming across a post with the same issue as yours but no conclusion other than "never mind, I fixed it!" so I'll just put the solution here:
In order to pass across the user's "real" http user agent in gtranslate.php we add in:
$request_headers['X-User-agent'] = $_SERVER['HTTP_USER_AGENT'];
anywhere near the other request_headers lines.
Then we detect if HTTP_X_USER_AGENT is set. If it is we use the X user agent, rather than the incorrect "normal" user agent with code like:
function uagent_info() { $this->useragent = isset($_SERVER['HTTP_USER_AGENT'])?strtolower($_SERVER['HTTP_USER_AGENT']):''; $this->httpaccept = isset($_SERVER['HTTP_ACCEPT'])?strtolower($_SERVER['HTTP_ACCEPT']):''; if(isset($_SERVER['HTTP_X_USER_AGENT'])){ $this->useragent = isset($_SERVER['HTTP_X_USER_AGENT'])?strtolower($_SERVER['HTTP_X_USER_AGENT']):''; } //Let's initialize some values to save cycles later. $this->InitDeviceScan(); }
}
This issue only seemed to affect Google Bot, rather than "actual" customers. I have no idea why but if you're using gtranslate with a mobile and desktop template I'd check that the bot is seeing the mobile template when it should and not the desktop version.
Email me at [email protected] if you have similar issues.
Re: Googlebot seeing desktop version of site instead of mobi
Mar 19, 2018 12:11 am by Edvard
Mar 19, 2018 12:11 am by Edvard
Hi,
Thanks for the information.
When User-agent contains Googlebot,Bingbot,slurp,baiduspider,msnbot we set the User-Agent to GTranslate-Translation-Proxy to avoid being blocked by some stupid firewalls which check the IP address of the request user and if it is not originating from Google,Bing,etc they block the request.
Thanks!
Re: Googlebot seeing desktop version of site instead of mobi
Mar 21, 2018 5:47 pm by zoeball
Mar 21, 2018 5:47 pm by zoeball
Brilliant advice, thank you. I installed the plugin on my wordpress install that was using a mobile friendly plugin called WP Touch and had similar issues. The advice here has pointed me in the right direction, so thank you.
Re: Googlebot seeing desktop version of site instead of mobi
Mar 21, 2018 11:22 pm by natastna2
Mar 21, 2018 11:22 pm by natastna2
No problem Zoe
Glad to have been of help!
SIMILAR TOPICS
how to translate site right to left for arabic in WordPress | Dec 26, 2018 9:02 am | Replies: 1 | Post by: Hammond753 |
Would you share your site URL? | Dec 3, 2018 4:57 pm | Replies: 1 | Post by: BevVincent |
G Translate on 2 menus on wordpress (desktop and mobile) | Nov 1, 2018 3:33 pm | Replies: 1 | Post by: investatemiami |
Can I Translate Only Few Elements Of My Site? | Aug 16, 2018 1:31 pm | Replies: 1 | Post by: riyagupta |
SSL for my site has been expired, please renew it | Mar 21, 2018 1:48 pm | Replies: 1 | Post by: besybuy |