Tracking Internal Searches

Overview

Internal searches are performed on a page within a Web site. These searches look for content within that Web site. That is, the search is made for results that are found internally within the site.
In order to effectively track internal searches and provide for reporting on those searches, the columns listed in the following table have been added to the output detail data set:
Internal Search Output Columns
Column Name
Default Value
Description
int_search_result_page
0
Contains a value of 1 if the corresponding Requested_File being accessed is a page that contains search results.
int_search_term
Missing
Search string for which the user submitted a query to the search page.
int_search_result_count
Missing
Count of the number of search results found. Only available when you use the page-tagging template job.
Note that the SAS page tag tutorial and template jobs output all three of the internal search output columns. Note that standard Web logs do not contain the information about search results needed to set int_search_result_count. Therefore, the Standard Web Log tutorial and template jobs only output int_search_result_page and int_search_term.
You can enable these internal search output columns by performing the following tasks:

Populating the int_search_result_page and int_search_term Columns

The int_search_result_page column specifies the page that contains the search results and the int_search_term specifies the query string parameter used for the search term. You can set up these columns in the Rules tab of the Clickstream Parse transformation for the template jobs by editing the rules in the Search group.
The settings that you need to make are listed in the following table:
Settings for the int_search_result_page and int_search_term Rules
Option
Location
Setting
Notes
Enable Set int_search_result_page rule
Clickstream Parse (Rules tab)
Yes (in Enable column)
None
Set Column search
Clickstream Parse (Rules tab)
Search.php (default)
For the Set int_search_result_page rule, access the Rule Properties window. Then, click Search Options to review or change the default.
Set Assign column
Clickstream Parse (Rules tab)
Set Column to int_search_result_page and Value to 1
Also in the Rule Properties window.
Add query string parameter containing the internal search term
Clickstream Parse (Clickstream Parameters tab)
Set Name to q and User Column to int_search_term
Add a new Clickstream Parameter, setting Name to the parameter that contains the search term (q in this example), and User Column to int_search_term.

Populating the int_search_result_count Column

The int_search_result_count (ISC) column displays the number of search results found when you enable it in a page-tagging template job. This column is available only in tutorial and template jobs that are processing a SAS page tag data source. This function is automatically handled by the SAS page tag template job, provided that the tagging data element ISC is captured within the tag code. The SAS page tag setup job automatically generates test data containing this element. Perform the following steps to add ISC to the data elements being captured by the tag:
  1. Ensure that your search results page is tagged.
  2. Add JavaScript code to the st_pageDats() method on the search results page that retrieves the number of search results. Then it sets the value of the ISC data element to this number. For example, you can add the following code:
    function st_pageDats()
    {
    		// Add code here which retrieves the number of search results
    		result_count=”100”;
    
    		// Set ISC value to the number of search results on page load (0x1)
    		st_rq.dats.add( “ISC”, result_count, true, 0x1);
    }
    
    This step passes the value of ISC passed from the SAS page tag to the collection server. When the SAS page tag Web log is processed from the collection server by the SAS page tag template job, this job automatically parses the value of ISC into the int_search_result_count column of the job’s output table.