Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Rethink: SearchEngines.php #1694

Closed
robocoder opened this Issue · 25 comments

3 participants

@robocoder
Collaborator

The current data file:

  • requires exact match on domains; as a result, we have numerous 'holes':
    • country code tlds (e.g., www.example.ca, www.example.us)
    • country subdomains (e.g., ca.example.com, us.example.com)
    • wildcard subdomains (e.g., *.example.com)

Proposal:

  • use Public Suffix List and/or regular expressions
  • backfill data from the master record at runtime to avoid unnecessary duplication
    • we already do this to some extent; in which case, we just need to prune some entries (e.g., Baidu)

Affects:

  • Piwik_Common::extractSearchEngineInformationFromUrl()
  • plugins/Referers/functions.php

ToDo:

  • strtolower in comment:1
  • iconv in comment:2
@robocoder
Collaborator

I see we call strtolower on the keywords. This may not be safe to do with the 'C' locale unless it happens to be UTF-8 aware.

@robocoder
Collaborator

Task: review the iconv() code in extractSearchEngineInformationFromUrl(). The keywords from naver.com are showing up empty. The encoding in SearchEngines.php is specified as x-windows-949 (which I gather is a superset of the search page's charset, euc-kr).

@robocoder
Collaborator

(In [3136]) refs #1694 - detect powered by google custom search

@robocoder
Collaborator

(In [3141]) refs #1694 - prune arrays (these will be backfilled from the master record)

Separate "Powered by Google" (i.e., uses Google exclusively for search) from "Enhanced by Google" (uses Google in addition to other search engines); the latter are treated as separately branded (meta) search engines.

@robocoder
Collaborator

(In [3142]) refs #1694 - add unit tests for missing and obsolete search engine icons; adapted from halfdan's ProcessFavIcons.php in #1350

@robocoder
Collaborator

(In [3144]) refs #1694 - add Piwik_Common::getLossyUrl($url) to reduce referrer URLs to
a more basic form/pattern. I'll prune the Google and Yahoo entries later.

@robocoder
Collaborator

(In [3145]) refs #1694 - fix forestle.org and add unit test (i.e., {} can't appear in master record)

@robocoder
Collaborator

(In [3146]) refs #1694 - update favicon names

@robocoder
Collaborator

(In [3149]) refs #1694 - applied lossy {} tld to 123people, google, lycos, and yahoo

@sgiehl
Collaborator

Replying to vipsoft:
some google entries are duplicates and can be removed (line 381 & 382)

@robocoder
Collaborator

(In [3150]) refs #1694

@robocoder
Collaborator

(In [3151]) refs #1694 - lossy Bing images URL

@robocoder
Collaborator

Note: users who view a cached page from Bing search results will result in a pageview on cc.bingj.com. I've suggested that they add the original web site's URL (uuencoded, of course) to the link. That way we can parse it out (similar to webcache.googleusercontent.com).

@robocoder
Collaborator

(In [3161]) refs #1694 - add bing cache

@robocoder
Collaborator

I'm thinking of adding a hook so plugins can implement their own search engine detection as there are requests for sites to be added that don't quite fit the traditional definition of a search engine.

@robocoder
Collaborator

(In [3162]) refs #1694 - remove fix-up for webcache.googleusercontent.com; moving the logic to piwik.js

@robocoder
Collaborator

(In [3163]) refs #739, refs #1694 - instead of a bing cache buster, detect when page is loaded from google or bing cache, and apply a fix to the url

@robocoder
Collaborator

(In [3164]) refs #739, refs #1694 - fallback to the cache url if we can't parse it

@robocoder
Collaborator

(In [3165]) refs #1694, refs #739 - make cacheFixup() testable

@robocoder
Collaborator

Yahoo's Bing-powered search has an even weirder cache url.

@robocoder
Collaborator

(In [3167]) refs #1694, refs #739 - Yahoo's cache result is served from Inktomi allocated ip addresses

@robocoder
Collaborator

(In [3168]) fixes #1694 - misc fixes

  • if iconv fails, we use the original key
  • use mb_strtolower if available; apply this conversion after iconv
  • provide an icon when www.google.com/cse
@mattab
Owner

Great work :) this will make maintenance a lot less tedious.

Is there a reason www.google.cat is still listed, or can it be removed?

@robocoder
Collaborator

Technically, .cat isn't an ISO country code. But since I've already added the MaxMind codes to Countries.php, I guess it won't hurt to add this one too.

@robocoder
Collaborator

(In [3319]) refs #1694 - treat .cat as a pseudo country tld

@robocoder robocoder added this to the Piwik 1.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.