diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-15 11:41:12 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-15 11:41:12 +0400 |
commit | 5364959053ad9f086a37eff591bed7db7de67add (patch) | |
tree | 7a5675d8c0da719dd88370bbba0efc8366888b58 /libs | |
parent | 5bc36eb3cac3421f7a592edee11528e63252e841 (diff) |
Refs #2992 Site Search KABOOM, Refs #49
Implementing Site Search tracking & reporting in Piwik core!
* New Admin UI to customize, for each site, wheter site search is enabled. Also options to set default values to use.
* New Reports: Searches, Searches with no result, Search categories, Top Pages Following a Search
* to track "No result keyword" users will have to tag their site with a JS call, or add a new parameter to the search result page &search_count=X (X being zero for no result searches)
* Reports works with Row evolution, PDF/HTML reports, Piwik Mobile
* idaction_url is now NULLable because, Site Search records a page with idaction_name == Keyword, and idaction_url == NULL. This ensures that the Site Searches don't create "Page URL Not defined" records.
* updates to Tracker JS API, new function trackSiteSearch, also added in PHP tracker
* New fields in log_visit to track searches
* new segment, "searches" which can be used to select visitors who did a search ie. searches>0 or those who searched a lot, ie searches>10
TODO:
* commmit integration test, TESTING, DOCS, FAQ, release, and a nice Prayer to the universe and the stars, hoping that I can code a major new feature without any bug...
* It would be awesome to have compatiblity with Transitions so we can see, for a given site search, what are the starting pages and Destination pages
Thank you for your patience Timo,
and thank in advance everyone for your help Testing this new feature!
git-svn-id: http://dev.piwik.org/svn/trunk@7190 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs')
-rw-r--r-- | libs/PiwikTracker/PiwikTracker.php | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php index 34cc5839e1..ce94f2649a 100644 --- a/libs/PiwikTracker/PiwikTracker.php +++ b/libs/PiwikTracker/PiwikTracker.php @@ -270,8 +270,24 @@ class PiwikTracker { $url = $this->getUrlTrackPageView($documentTitle); return $this->sendRequest($url); - } - + } + + /** + * Tracks an internal Site Search query, and optionally tracks the Search Category, and Search results Count. + * These are used to populate reports in Actions > Site Search. + * + * @param string $keyword Searched query on the site + * @param string $category Optional, Search engine category if applicable + * @param int $countResults results displayed on the search result page. Used to track "zero result" keywords. + * + * @return string|true Response or true if using bulk requests. + */ + public function doTrackSiteSearch( $keyword, $category = false, $countResults = false ) + { + $url = $this->getUrlTrackSiteSearch($keyword, $category, $countResults); + return $this->sendRequest($url); + } + /** * Records a Goal conversion * @@ -528,6 +544,22 @@ class PiwikTracker } return $url; } + + /** + * @see doTrackSiteSearch() + */ + public function getUrlTrackSiteSearch($keyword, $category, $countResults) + { + $url = $this->getRequest( $this->idSite ); + $url .= '&search=' . urlencode($keyword); + if($category !== false) { + $url .= '&search_cat=' . urlencode($category); + } + if($countResults !== false) { + $url .= '&search_count=' . (int)$countResults; + } + return $url; + } /** * @see doTrackGoal() |