1

I'm having some issues finding out a way to block the logic on my PHP page from being triggered when google visits it to shorten the url, we used to use bitly and knew their user agent string, so we could target it and just not preform anything when a bot like that came by, but now we are switching to google for this service, but the same logic to prevent execution has stopped working (obviously). I was wondering if anyone had an idea to simply bypass this (or just the UA string from the goo.gl service would be nice too!).

The short links are used in a text message to our customers, we don't want to add a button to the page, since this adds another click to the equation

Stagg
  • 63
  • 1
  • 13

1 Answers1

0

Here is the list of google crawlers user agents: https://support.google.com/webmasters/answer/1061943?hl=en

But there is no entry for goo.gl service, but what I see in common is the string Google. You can check if this string is in user agent and do the same logic as before.

Other option is to log the useragents to a file or db or email and try to do a request for a short url and check the logs after goo.gl access your url.

Daniel Dudas
  • 2,972
  • 3
  • 27
  • 39