Customizing a Full Page Tag

Overview

All data elements to be tracked are stored in the browser’s memory before they are sent to the clickstream collection server. These data elements contain a key name, a value, and an enabled status. Only enabled keys have their values sent to the clickstream collection server. Tracking can be customized for each of the types of data that the page tag code is able to collect. This topic documents the procedure for the following elements:

Debug Mode

When you set up the initial tagging code, you can see the data that is sent to the clickstream collection server for a given page. This debug mode automatically scrolls to the top of the page. You can enable debug mode by simply inserting the line that includes SASTagDebug.js into the page tag code. For more information about this line, see Inserting a Full Page Tag.
When accessed, pages containing this line invoke a pop-up window that displays the configuration settings for the tag, data elements as they are being captured, and the exact data request that is being sent to the clickstream collection server. The debug mode window continues to update as actions such as link clicks and form-submit-button clicks are performed on the page. Note that there can be only one debug mode window open for a given browser.

Page Load Tracking

A page load event occurs anytime a page is loaded, refreshed, or returned to through the browser’s navigational buttons (forward or back). The occurrence of any of these actions always results in data collection. The data that is collected can be configured.

Predefined Data Elements

Most of the predefined data elements have a value populated and are enabled for collection by default. Generally, predefined data element values should not be changed. However, exceptions are documented in the following table, which lists the predefined data elements, including the key name, value, and default enabled status. The following table lists the predefined elements that can be collected:
Predefined Data Elements
Key Name
Description
Value
Default Enabled Status
VER
Displays the version number indicating the way the tag data is written.
2.1 (example)
Yes
EVT
Displays the type of user action or event that generated this line of data.
Valid values include load, click, and submit
Yes
RND
Indicates a random number.
Generated
Yes
CID
Displays the configurable ID that is included in a tag by default.
Default
Yes
VID
Displays the visitor ID that is created by storing a unique cookie in the user’s browser. If cookies are enabled, this value is the same on each return visit to the Web site.
Generated
Yes
PID
Displays the page ID. This value is blank by default and serves as a place holder if a specific ID needs to be set when configuring the page code.
Not applicable
Yes
URI
Displays the Uniform Resource Indicator.
URI of Web page
Yes
REF
Displays the name of the referrer, which must be captured by the tag. In this context, the referrer is always the tagged page.
Not applicable
Yes
TTL
Displays the page title.
The title of the page
Yes
PROT
Displays the protocol of the URI being requested.
http or https
Yes
DOM
Displays the domain of the URI being requested.
W3C-domain
Yes
PORT
Displays the port of the URI being requested.
Port that received the request
Yes
CPU
Displays the CPU Class (when available).
x86 (example)
Yes
PLAT
Displays the platform (when available).
Win32 (example)
Yes
SINFO
Displays the screen resolution and color depth. Screen information is in the form of Width Height@Colors. For example, 1280x1024@32 indicates 1280 pixels wide by 1024 pixels high at 32-bit color depth.
1280x1024@32 (example)
Yes
FL
Displays whether Flash is enabled.
1 (true) or 0 (false)
Yes
FLV
Displays the Flash version.
WIN 10,0,22,87 (example)
Yes
CK
Displays whether cookies are enabled.
1 (true) or 0 (false)
Yes
JV
Displays whether Java is enabled.
1 (true) or 0 (false)
Yes
JVV
Displays the Java version.
1.5.0_11
Yes
JS
Displays whether JavaScript is enabled.
1 (true) or 0 (false)
Yes
SLNG
Displays the system language.
en-us (example)
Yes
BLNG
Displays the browser language.
en-us (example)
Yes
ULNG
Displays the user language.
en-us (example)
Yes
DT
Displays the client computer date.
4/7/2009 (example)
Yes
TM
Displays the client computer time.
16:1:48.663 (example)
Yes
M_Meta_Tag_Name
Displays the Meta tags.
Meta tag name/value pairs
Yes
C_Cookie_Name
Displays the Cookies tags.
Cookie tag name/value pairs
Yes
F_Form_Element_Name
Displays the Form Data (POST/GET) tags.
Form tag name/value pairs
No
CS
Contains the character set encoding of the data being collected. This setting is based on the character set encoding specified in the page or browser.
UTF-8
Yes
When available in the user’s browser, the data elements listed in the preceding table are collected on each page load. Many are also collected (where applicable) by clicking a link or selecting the Submit button.

User-Defined Data Elements

In cases where the predefined data elements do not provide enough information, user-defined data elements can be tracked. Code to track these data elements is added to either the st_siteDats() method in SASSiteConfig.js, or the st_pageDats() method in the full page tag code. Add the code to the former to track across multiple pages in your site or to the latter to track a data value for a specific page. For example, a content group value might be desired when several pages need to be classified as part of the same group of content. This value, if accessible from JavaScript, can easily be added to the set of data elements to track, as shown in the following code:
function st_siteDats()
{
   // Track a data value for all pages in this
   // site as "MarketingPages" since we
   // are dealing with our Marketing site.
   st_rq.dats.add("CONTENT_GROUP","MarketingPages",true,0x4 
      /*capture on page load only*/);
}
This example collects a new data value for all pages that include SASSiteConfig.js. The benefit of using an externally included configuration file such as SASSiteConfig.js is that the tagging code on each page does not have to be edited to make global changes across multiple pages. If, however, you would like to collect a data element for a specific page, such as the total on a shopping cart page, you can use the following page code:
function st_pageDats()
{
   // Track the shopping cart total for this page only
   st_rq.dats.add("CART_TOTAL",nTotal,true,0x1); /*capture on form submit only*/);
}
More information about the add() call can be found in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/. Look up “add” in the “Method Detail” section in the documentation for the ST_Dats class.

Meta Tag Tracking

By default, all meta tags on the page being accessed are tracked. Meta tag values are tracked by assigning an M_ prefix to the name of the meta tag. For example, a meta tag value of CATEGORY with a value of BOOK is tracked as the name/value pair M_CATEGORY=BOOK.
Meta tag tracking is configured by using the st_cfg.cap[‘M’] array element. For example, you can turn off meta tag tracking with the following code in either the st_siteCfg() or st_pageCfg() methods: st_cfg.cap['M']="0";. You can also capture only the meta tag named Author with the following code: st_cfg.cap['M']="0:Author";. For details about configuring meta tracking, see the documentation for the st_cfg.cap array element in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/.

Cookie Tracking

By default, all cookies for the page being accessed are tracked. Cookie values are tracked by assigning a C_ prefix to the name of the cookie. For example, a cookie named CART_ID with a value of 32567 is tracked as the name/value pair C_CART_ID=32567.
Cookie tracking is configured by using the st_cfg.cap[‘C’] array element. For example, you can turn off cookie capture with the following code in either st_siteCfg() or st_pageCfg(): st_cfg.cap['C']="0";. You can capture only chocolate, macadamia, and fudge cookies with the following code: st_cfg.cap['C']="0:chocolate,macadamia,fudge";. For details about configuring cookies tracking, see the documentation for the st_cfg.cap array element in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/.

Link Tracking

A link on a page is tracked if the page tag configuration results in the collection of data when the link is clicked. Links are tracked based on the file type of the target of the link. By default, links to all file types are instrumented with the exception of the following: htm, html, asp, aspx, cfm, do, and php. These link types are exceptions because these pages can be tagged. Therefore, their content can be directly tracked.
Link instrumentation is configured by using the st_cfg.cap[‘L’] array element. The default setting of st_cfg.cap['L']=""; tracks every link on a page. However, you can change the link configuration in either st_siteCfg() or st_pageCfg()). For example, you can enter st_cfg.cap['L']="0"; to prevent the tracking of any links.
If you enable link tracking with st_cfg.cap['L']="";, you can also track specific types of links by configuring the st_trk element. See Configuring Link Tracking in Tagged Pages for detailed information. For details about configuring link tracking, see the documentation for the cap array element in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/.
You can also add code to enable and disable the stop-and-re-click behavior that stops the user's initial click, collects data, and then re-clicks. Use the st_trk() method to determine whether an item is tracked and instrumented for data collection, as follows:
function st_trk(o)	
 {
    switch(o.nodeName.toLowerCase())
 	  {
       case 'a':  // Link elements
          return true;
          break;
       default:
          return true;
    }
 }
If you do enable tracking with st_trk(), you can optionally use the st_sar() method to control how data is collected. This method enables you to use your own programming logic to control the stop-and-re-click behavior on and off, as follows:
 function st_sar(o)	{
  switch(o.nodeName.toLowerCase())
  {
     case 'a':  // Link elements
        if ( o.href.indexOf('action=watch')>0  // MediaWiki watch/unwatch 
           button handling
          || o.href.indexOf('action=unwatch')>0)
           return false;
        else
           return true;
        break;
     default:
        return true;
  }
For details about configuring stop and re-click behavior, see the documentation for st_trk() and st_sar() in the “SASSiteConfig.js” section in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/clk21.

Form Tracking

A form on a page is tracked if the page tag configuration results in the collection of data when the user clicks a submit button on the form. Form element values are tracked by assigning an F prefix to the name of the form element. For example, a form element named FIRST_NAME with a value of John would be tracked as the name/value pair F_FIRST_NAME=John.
Form instrumentation is configured by using the st_cfg.cap[‘F’] array element. For example, you can turn off tracking for every form on a page by changing the form configuration in either st_siteCfg() or st_pageCfg() as follows: st_cfg.cap['F']="0"; In addition, you can enter the following code: st_cfg.cap['F']="1:1:formA,ccard,expdate:0:formB,fname,lname". This code tracks all of the forms on the page, but it (1) skips the elements named ccard and expdate in a form named formA and (2) captures only the elements named fname and lname in a form named formB. For details about configuring form tracking, see the documentation for the cap array element in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/.
Note: Form content (other than password fields) is not captured by default. If forms on your site do collect sensitive information, then this data is collected from the form, transmitted using the protocol of the collection server (http or https), and stored in the collection server's log file. Make sure that form tracking is configured with this in mind and store only what is appropriate. This sensitive information includes, but is not limited to, credit card numbers, bank account numbers, and personally identifiable information. Additionally, access to the clickstream collection server's Web log file should be restricted to authorized users only.
For more information about the security aspects of form data capture, see Evaluating Security Issues for Form Capture.
The tracking of form data requires the page that contains the forms to be tagged. Data collection is performed on the following form elements:
Text fields
<INPUT type=”text">
Hidden fields
<INPUT type=”hidden">
Password fields
<INPUT type=”password"> Note that for password fields, the field name is collected, but the password value is not collected. A value of X is collected in place of the password. This setting is not configurable.
Text areas
<TEXTAREA>
Radio buttons
<INPUT type="radio">
Check boxes
<INPUT type="checkbox"> Check box data collection passes the value of each checked item, delimited by commas.

Rich Internet Application Tracking

A rich Internet application is an embedded object within a Web page that typically has its own self-contained functionality that is separate from the main HTML in the page. An example of this is an embedded Flash object.
Generally, any embedded object can be tracked if the object meets the following criteria:
  • The object is programmable.
  • Tracking code can be inserted at the point of interest.
  • Calls to JavaScript can be made from the coding language of the object.
When these criteria are met, user actions within the rich Internet application can be tracked with the following JavaScript calls:
st_rq.dats.add("Name1","Value1",true,0x2 /* capture for click events only */);  
st_rq.dats.add("Name2","Value2",true,0x2 /* capture for click events only */);
st_rq.dats.add("Name3","Value3",true,0x2 /* capture for click events only */);
st_rq.send(st_rq.RQST_CLK,”click”);
These calls are documented in detail in the SAS Data Surveyor for Clickstream Data 2.1 Page Tagging JavaScript Reference at http://support.sas.com/rnd/gendoc/clickstream/21M1/en/. In particular, the call for add() is covered in the section for the ST_Val() class and the eFlags field name.
For example, you can track user clicks from ActionScript within a Flash object when the user clicks the left mouse button by creating a trackEvent function in the coding language of the rich Internet application. The following code was created in Flash:
function trackEvent(event:MouseEvent):Void {
     ExternalInterface.call("st_rq.dats.add","EVNT",event.target);
      ExternalInterface.call("st_rq.send");
  }
In this case, every mouse movement passes an EVNT parameter and an indication of the user action that occurred.