Introduction

Many sites use different url formats. You can use URL Normalization to reduce the logging of different urls that might be equivalent or redundant. A custom function with no implementation is added as a placeholder in the configuration that eventually defines how a url is normalized.

Some normalization techniques include:

  • removing parameters
  • masking parameter values
  • replacing targeted text
    • The same normalization function is used to normalize urls in the Overstat, Replay, and Ajax Listener Tealeaf modules. Both the normalized and original urls are recorded in these modules. Tealeaf records the urls in type 2 messages (load/unload) for Overstat and Replay, and in type 5 message for Ajax Listener.

      After you provide the implementation, ensure that adequate testing is performed. Testing ensures that the resulting url is normalized in the desired format.

      Configuration

      The input normalization configuration is specified in the core object of the JSON configuration.
      Both normalization and urlFunction properties are mandatory and must be declared as below.

      core: {
          normalization: {
              urlFunction: function (urlOrPath) {
                  // Normalize the input URL or path here.                                                                
                  // Refer to the documentation for an example to normalize the URL path or URL query parameters.         
                  return urlOrPath;
              }
          }
      }
      

      Sample implementations

      Remove parameter

          urlFunction: function (url) {
              return url.replace("/param1/123","");
          }
       
      

      Replace parameter value

          urlFunction: function (url) {
              return url.replace("/param1/123","/param1/XXX");
          }
       
      

      Convert querystring

      Note: Overstat and Replay tend to strip out the querystring from url. Use slash, underscore, or other delimiters.

          urlFunction: function (url) {
              return url.replace("?user=","_");    // abc.com?user=john  ->  abc.com_john
          }
      

      Convert querystring

           urlFunction: function (url) {
              return url.replace("?","/").replace("&","/");    // abc.com?user=john&age=30  ->  abc.com/user/john/age/30
          }
      

      1 comment on"URL Normalization"

      1. How do you normalize the ajax url from the ajax listener?

      Join The Discussion

      Your email address will not be published. Required fields are marked *