Configuring Link Tracking in Tagged Pages

Problem

You want to configure which links are tracked on the tagged pages.

Solution

You can modify the JavaScript tagging code for your site or your tagged pages to support the tracking for specific types of links. These code modifications only take effect if you accept the default setting of st_cfg.cap['L']="";, which enables the tracking of all links. This default setting is also sufficient for the link tracking needed for following scenarios:
Tracking Off-Site Links
Off-site links are present. These links are found when you have tagged pages of interest for your organization’s site but your site also includes links that direct the user to another organization’s Web site. Data about when these links are accessed is normally missing because it is not possible to tag the other organization’s web pages. You want to know when these links are accessed, but you do not want to use tagged redirect pages as a detection mechanism because of the maintenance overhead.
Tracking Non-Tagged Intra-Site Links
Non-tagged intra-site links are present. These links are found when you have tagged pages of interest for your organization’s site but your site also includes links that direct the user to another department or sub-site within the organization that cannot be tagged. Data about when these links are accessed is normally missing because it is not possible to tag the other department or sub-site's web pages. You want to know when these links are accessed, but you do not want to use tagged redirect pages as a detection mechanism because of the maintenance overhead.
Tracking Links to Non-Taggable Content
Links to non-taggable content are present. These links are found when you have tagged pages of interest for your organization’s site but your site also includes links from pages on the organization’s site that access content that cannot itself be tagged (such as PDF and XLS). You want to know when these links are accessed, but you do not want to use tagged redirect pages as a detection mechanism because of the maintenance overhead. In addition to the default tracking of all links, you can use the approach described in Tracking Links By File Extension.
Note: The following features are available only in the maintenance release of SAS Data Surveyor for Clickstream Data 2.1:
  • the ability to track clicks on links based on attributes other than the file extension of link target
  • the ability to track clicks on links that leave the Web site.
The following scenarios require you to use enter code under the st_trk function:

Tasks

Tracking Links By File Extension

Use the st_cfg.cap[‘L’] array element to specify the file types that you need to track. For example, you can track only the links to PDF, DOC, and XLS files with the following code: st_cfg.cap['L']="0:pdf:doc:xls";.
Note: Setting st_cfg.cap['L'] to a non-blank value turns off the use of st_trk. If there are other conditions besides tracking by file extension to consider when determining whether a link should be tracked, do not use this approach. Instead, set st_cfg.cap['L']="" and write code for each condition to be checked in st_trk.

Tracking Links By ID

You can limit your tracking to specific links on a given page and base the tracking decision on the ID of the link. This approach enables you to avoid gathering tracking data for all of the other links on the page. For example, you can track the IDs of two links, such as linkID1 and linkID2.
To implement this approach, ensure that st_cfg.cap['L']=""; has been entered to enable link tracking. Then, define the st_trk function in the SASSiteConfig.js file as follows:
function st_trk 
{
	switch(o.nodeName.toLowerCase())
	{
   case ‘a’:		// Link elements
		if (o.id==’linkID1’) return true;
		if (o.id==’linkID2’) return true;
		return false;
		break;
	   default:
		return true;
}	
}

Tracking Links By Name

You can limit your tracking to specific links on a given page and base the tracking decision on the name of the link. This approach enables you to avoid gathering tracking data for all of the other links on the page. For example, you can track the names of two links, such as linkName1 and linkName2.
To implement this approach, ensure that st_cfg.cap['L']=""; has been entered to enable link tracking. Then, define the st_trk function in the SASSiteConfig.js file as follows:
function st_trk 
{
	switch(o.nodeName.toLowerCase())
	{
   case ‘a’:		// Link elements
		if (o.name==’linkName1’) return true;
		if (o.name==’linkName2’) return true;
		return false;
		break;
	   default:
		return true;
}	
}

Tracking Links By Other Attributes

You can limit your tracking to specific links on a given page and base the tracking decision on an attribute that you have defined and placed into the HTML for the links to track. This approach enables you to avoid gathering tracking data for all of the other links on the page.
For example, you can track links with a TRACKME attribute set to 1. With this attribute implemented, a link in the format <A HREF=”http://www.sas.com”>SAS</A> would change to <A HREF=”http://www.sas.com” TRACKME=1>SAS</A>
To implement this approach, ensure that st_cfg.cap['L']=""; has been entered to enable link tracking. Then, define the st_trk function in the SASSiteConfig.js file as follows:
function st_trk 
{
	switch(o.nodeName.toLowerCase())
	{
   case ‘a’:		// Link elements
		if (o.attributes[‘TRACKME’].value==’1’) return true;
		return false;
		break;
	   default:
		return true;
}	
}