Googlebot seeing desktop version of site instead of mobilel

Popular automatic website translation tool

Googlebot seeing desktop version of site instead of mobilel

Postby natastna2 » Fri Mar 16, 2018 7:06 am

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
natastna2
 
Posts: 157
Joined: Wed Jan 26, 2011 2:43 am

Re: Googlebot seeing desktop version of site instead of mobi

Postby natastna2 » Sat Mar 17, 2018 7:07 am

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.
natastna2
 
Posts: 157
Joined: Wed Jan 26, 2011 2:43 am

Re: Googlebot seeing desktop version of site instead of mobi

Postby natastna2 » Mon Mar 19, 2018 3:11 am

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.
natastna2
 
Posts: 157
Joined: Wed Jan 26, 2011 2:43 am

Re: Googlebot seeing desktop version of site instead of mobi

Postby Edvard » Mon Mar 19, 2018 4:11 am

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!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4400
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Googlebot seeing desktop version of site instead of mobi

Postby zoeball » Wed Mar 21, 2018 9:47 pm

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.
zoeball
 
Posts: 1
Joined: Wed Mar 21, 2018 9:39 pm
Location: London

Re: Googlebot seeing desktop version of site instead of mobi

Postby natastna2 » Thu Mar 22, 2018 3:22 am

No problem Zoe :-)

Glad to have been of help!
natastna2
 
Posts: 157
Joined: Wed Jan 26, 2011 2:43 am


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux
cron