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

Support for GSA (Google Search App) #117

Open
haydenth opened this issue Aug 30, 2019 · 4 comments
Open

Support for GSA (Google Search App) #117

haydenth opened this issue Aug 30, 2019 · 4 comments

Comments

@haydenth
Copy link

Great package. Thanks for doing this, I use it every day. One thing I am noticing in our logs is an increase in traffic from user agents like this:

Mozilla/5.0 (iPhone; CPU iPhone OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/81.0.264749124 Mobile/16G77 Safari/604.1

This is from the Google Search App v 81.0.264749124 (which appears to be using ios-webview v605.1.15). Is there any way this package can detect the GSA version versus the ios-webview version, or preferably both?

@DamonOehlman
Copy link
Owner

@haydenth despite not getting back to you until now, I've put a bit of thought into this and thinking about what we can do. I think my previous assumption that I could make a binary distinction between a bot/crawler and a "human-driven" browser was a little optimistic, as I suspect there is a lot of grey in the middle as you have pointed out.

So... what's the solution? Well, it would take a little bit of refactoring the code, but I'd propose that we would include the bot flag on the BrowserInfo returned so you could make a determination that you both detected a valid browser AND detect-browser thinks it's a bot.

Even though with this kind of refactor, I would bump the major version, I'd be making sure that detect-browser behaved in a consistent way (i.e. detected the above user agents as ios-webview). In your case (and others desiring the same functionality) you'd be able to check that bot flag and see if it was in fact a bot that made the request, and decide how you wanted to handle that.

Does this sound like a reasonable solution to you?

@haydenth
Copy link
Author

haydenth commented Sep 9, 2019

Hey - thanks for the response. So maybe it might help if I describe the post-processing we do with data coming out of the detect-browser library. The library works 💯 in 99% of the cases but I have some special logic that grabs two things:

  • Bots: Mostly Google + Baidu. Easily filterable by looking at the user-agent. I just append an is_bot flag to browser data.
  • (Sub) Browsers: The main one is the GSA app but there are a few others, I think facebook has one. A surprisingly large number of our users come from these apps and some of them are really buggy (GSA currently has a really nasty bug where it mangles react apps). If you're an iOS user, download the Google App (https://apps.apple.com/us/app/google/id284815942) and see how it uses ios-webview.

So I think bot and (sub) browsers are different things

@DamonOehlman
Copy link
Owner

OK cool, that all makes sense. I'll have a look at firing up an older iPhone (hopefully I can get the GSA app) and see what I can come up with.

@haydenth
Copy link
Author

cc @ryanmchenry2 who works with me and has access to a collection of janky old phones on his desk right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants