Kayako logo
Modifications & Addon Releases Modification guides and addons are posted here to share with the community. Do not post requests in here!

Notices

Reply
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  (#1) Old
smartohana Offline
Member
 
Posts: 38
Join Date: Nov 2007
How to track Search Terms - 12-01-2008, 04:16 AM

Unfortunately, one of SS's greatest weaknesses is it's reporting (IMHO). One of the most important reports missing entirely is a report on search terms entered by visitors to find information on your support site. Since most users are inclined to search, an analysis of search terms can provide key indicators as to what users are interested and need more assistance with when they come to your support site.

Fortunately, I believe I've implemented a viable workaround to this problem using Google Analytics as the reporting engine. I won't explain how to set up GA, but I wanted to share how I configured SS so that I can do some basic tracking of search terms.

Basically, you need to feed to GA the search terms entered by users in the search box. At first this might seem like the only thing you have to do is add the GA tracking javascript to your template. But there is a problem: SS search is performed using the POST method, which hides the search terms from GA. If you change the template to perform the search using GET method, your search breaks.

The trick is to feed the search terms to GA directly, rather than through the URL. This is done by including the search terms in the GA _trackPageview function which is part of the GA javascript code you include in each of your pages you wish GA to track (if you are familiar with GA, you'll know what this is all means).

Below is a snippet of the GA javascript, with my modifications.

PHP Code:
<{if ereg("Search Query"$sectiontitle)}>
<
script type="text/javascript">
var 
pageTracker _gat._getTracker("UA-xxxxxxx-x");
pageTracker._initData();
 
pageTracker._trackPageview("<{$sectiontitle}>");
</script>

 <{else}>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._initData();
 pageTracker._trackPageview();
</script>
 <{/if}> 
Couple of notes:
  • I include the GA tracking code in my footer template, since I track every page. NOTE: the variable: $sectiontitle includes the search terms, on the search results page. I want to pass this variable directly to GA, but $sectiontitle also contain different values when accessing different areas (Knowledgebase, News, etc...).
  • Therefore I have a condition (see blue text), which checks which section the user is looking at.
  • If user is performing a search, then pass $sectiontitle directly to GA:
{if ereg("Search Query", $sectiontitle)}>
....

pageTracker._trackPageview("<{$sectiontitle}>");


  • If not performing a search, don't pass anything directly to GA:
<{else}>
...
pageTracker._trackPageview();

I'll likely reformat the exact string passed to GA so the URL is nicer and perhaps helps improve the reporting, but for now, this looks like it works for me. Hope it works for others as well.
   
Reply With Quote
  (#2) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,258
Join Date: Jan 2006
Location: United Kingdom
12-01-2008, 09:46 AM

Hi smartohana,

Thank you for sharing this; it is indeed a useful guide. I believe that it will only work with the newer version of Google's urchin tracker?


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
  • This is not an official support forum - submit a support ticket.
   
Reply With Quote
  (#3) Old
smartohana Offline
Member
 
Posts: 38
Join Date: Nov 2007
12-01-2008, 03:36 PM

The specific code will only work with the latest version of GA, but the legacy urchin tracker can also be passed a specific URL, so the basic guide I've outlined should work for that too.
   
Reply With Quote
  (#4) Old
MAinc Offline
New Member
 
Posts: 8
Join Date: Jun 2008
Location: Detroit
26-06-2008, 12:56 PM

this seems like a VERY useful mod. I was just wondering though, where would I place the js? Do I insert it in a template or a php script?

Great job smartohana!
   
Reply With Quote
Reply

Tags
search, terms, track

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Client Side Ticket Search and Filter Jemrada Developers & Code 85 02-10-2008 12:03 PM
Perform search with GET method smartohana Developers & Code 6 22-05-2008 04:08 PM
Knowledgebase Knowledgebase -> Remember and record stats on KB search terms smartohana Feature Requests 2 19-12-2007 05:51 PM
Tickets -> Searching System -> "Search links" i.e. search keywords via $_GET params to share search result Olate Feature Requests 1 05-09-2007 08:00 PM
eSupport search function in v3 does not work correctly wyatt12 SupportSuite, eSupport and LiveResponse 0 30-10-2006 06:22 PM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46