@anonymous-matomo-user opened this Issue on November 29th 2010

Firstly the new google images has several possible values after the tld which are (as far as I know)

(imgres|imghp|images|imglanding)

this means some visits from google images won't be recognised as such the way core/common.php is coded currently.

Secondly I want to report individual google countries which means the code in core/common.php which is as follows, won't work.

if($searchEngineName == 'Google Images'
    || ($searchEngineName == 'Google' && strpos($refererUrl, '/imgres') !== false) ) {
  $query = urldecode(trim(strtolower(self::getParameterFromQueryString($query, 'prev'))));
  $query = str_replace('&', '&', strstr($query, '?'));
  $searchEngineName = 'Google Images';
}

the first statement won't work if anyone changes the name of the search engine such as when splitting google to report individual countries. Perhaps it would be better to look for the string "Google Images" instead of equality. The same applies with looking for Google with equality.
For eample if I split google to use "Google UK" and "Google Images UK" as my searchEngineName then above code won't work whereas a string search for "google images" or "google" would.
Also final setting of searchEngineName should retain the original name if it already comtained the word images.
This is not perfect but that is because the code in common.php is already a hack which is less than perfect.
Keywords: interesting

@robocoder commented on November 29th 2010 Contributor

Closing since tlitody didn't register with an email address.

Replying to tlitody:

Firstly the new google images has several possible values after the tld which are (as far as I know)

(imgres|imghp|images|imglanding)

this means some visits from google images won't be recognised as such the way core/common.php is coded currently.

I don't believe all of these are Referer URLs.

Secondly I want to report individual google countries which means the code in core/common.php which is as follows, won't work.

This has come up a few times in the forum (merged topic), but hasn't been placed on the roadmap.

Part of me says we should provide more granularity as an option because without consolidation, there's more data to archive. And if we have both, way more data. It could be viewed as similar to the way we have Browsers vs Browser Families.

@anonymous-matomo-user commented on November 29th 2010

Well I have had recent visits from google.com.hk and google.com.ph which both used /imglanding after the domain. But they both had "q=" and "prev" containing the search phrase. So ommitting a check for imglanding puts the keywords in a non google images count which is suspect.
When trying to reproduce it I get imgres but I'm using a UK IP so results may be different.

But importantly, anyone thinking they can change google searchengine name, without understanding how the code in common.php works, will find it just doesn't work because of the way its coded currently. Most users, I suspect, will just think they can change the search engines to whatever they like but the enforced default to "Google Images" is likely to be a mystery to them. I see no need to enforce that. If users then choose to change searchengine names they can.

I have now changed my code and it seems to be working. It works on the principle that if the domain contains google, then it checks for /imgres and if found it does its stuff. But also within the original google check, checks for "images" in search engine name and if not found adds it to end of search engine name.
So this works for both the current standard setup but also works for anyone changing their search engine names for google (I think).

original code in common.php:


        if($searchEngineName == 'Google Images'
            || ($searchEngineName == 'Google' && strpos($refererUrl, '/imgres') !== false) )
        {
            $query = urldecode(trim(strtolower(self::getParameterFromQueryString($query, 'prev'))));
            $query = str_replace('&', '&', strstr($query, '?'));
            $searchEngineName = 'Google Images';
        }

my new code:

  if ( strpos(strtolower($searchEngineName), 'google') !== false && strpos($refererUrl, '/imgres') !== false ) 
        {
            $query = urldecode(trim(strtolower(self::getParameterFromQueryString($query, 'prev'))));
            $query = str_replace('&', '&', strstr($query, '?'));
            if ( strpos(strtolower($searchEngineName), 'images') === false )
   {
             $searchEngineName = $searchEngineName . ' Images';
            }   
        }

I have also changed my search engine names but that is another matter.

p.s. you now have my email address.

I just thought it would provide flexibility for those wanting to change their google searchengine names to split by country. The default names can remain as now but users don't have to worry about code not working if they do decide to change them.

This Issue was closed on November 29th 2010
Powered by GitHub Issue Mirror