Code File Library - Customer Passed Parameters (CPPs)

Customer Passed Parameters (CPPs) are used to send data points available on the client’s website along with the survey response. The value of these parameters can be used for segmenting the client’s respondent data. The client may send as many parameters as desired using the methods described in this topic. ForeSee suggest limiting CPPs to meaningful data intended for specific reporting.

Note
IE limits the number of characters in a URL string to 2084 including the URL to the survey. If additional CPP’s cause the URL to exceed this limit, data may not be passed with the survey and unavailable in the portal.

Method 1: The CPP API

The API in the Setting a CPP code sample can be used to manually set a CPP on the client’s site. This line can be duplicated as many times as desired, taking care that it’s placed below the call to foresee-trigger.js on the page. The foresee-trigger.js must be loaded first to avoid failing due to the FSR object not being defined.

In the following example, ‘name’ is the name of the CPP to be passed and viable in the portal. The value can be either a static hardcoded value, or a dynamic variable which can be customized to pass whatever data is preferred.

Setting a CPP:

FSR.CPPS.set('name','value');

Method 2: Adding CPPs to the code

This method of adding CPPs keeps all the CPP logic directly in the code’s configuration file (foresee-surveydef.js file). This method is helpful because it keeps all the logic in one place and helps ensure the CPP logic isn’t accidentally removed during a site change.

The following snippets of code can be added to the ‘FSR.properties’ section of the foresee-surveydef.js file.

Tip
It is recommended to always set up an “init” value as “N”, “None”, “Null”, “False”, etc. so that the CPP is not left blank in the portal when a value isn’t present. It is not possible to segment on blank values.

Passing the value of a variable:

The following code sets a CPP called ‘category’ passing the value of a variable on the site called ‘cat’.

FSR.properties = {
   cpps: {
      category: {
         source: 'variable',
         name: 'cat',
         init: 'none' //initial value of CPP if no variable exists
      }
   }
}

Passing the value of a cookie

The following code sets a CPP called ‘authenticated’ using a cookie with the name ‘auth’.

FSR.properties = {
   cpps: {
      authenticated: {
         source: 'cookie',
         name: 'auth'
         init: 'false' //initial value of CPP if no cookie exists
      }
   }
}

Creating a CPP using a URL

The following code sets a CPP called ‘support’ with a value of ‘true’ when the URL contained a string like ‘/support’.

FSR.properties = {
   cpps: {
      support: {
      source: 'url',
      init: 'none', //initial value of CPP if pattern isn’t present
      patterns: [{
         regex: '/support',
         value: 'true'
      }]
   }
}

Creating a CPP using a Meta Tag

The following code sets a CPP called ‘CountryCode’ with the value of the Meta tag named ‘DCSext.CountryCode’.

FSR.properties = {
   cpps: {
      CountryCode: {
         source: 'meta',
         init: 'none', //initial value of CPP if no meta tag exists
         name: 'DCSext.CountryCode'
      }
   }
}

Creating a CPP using a URL query string parameter

The following code sets a CPP called ‘q’ with the value of the parameter in the URL.

FSR.properties = {
   cpps: {
      searchterms: {
          source: 'parameter',
          name: 'q'
      },
   }
}

How to know if CPPs are being passed

Method 1: fsr.s cookie

Open the fsr.s cookie to view the parameters inside the “cp” attribute. CPPs are listed as name then current value to be passed.

"cp":{"ads":"none","icmpid":"none","cmpid":"none","icid":"none","cid":"none"},

Method 2: Survey URL

When a survey questionnaire appears, find the CPP parameters in the URL string:

http://survey.foreseeresults.com/survey/display?sid=browse-clientsite.com-en&cid=gcdwU50NZxxRxwJI1IEw%3D%3D&pattern=http%3A%2F%2Fwww.clientsite.com%2F&a=1293032648063_751683&b=38790979455466765205&c=86400000&version=5.0.0&cpp[orderDate]=12%2F22%2F2010&cpp[TLSessionID]=4EEBFE540DE2100D7A51B7D51C444613&cpp[browser]=Firefox%203.6&cpp[os]=Windows&cpp[pv]=2&cpp[url]=http%3A%2F%2Fwww.clientsite.com%2F&cpp[ref_url]=&cpp[locale]=en&cpp[site]=clientsite.com&cpp[section]=&cpp[referrer]=&cpp[terms]=&cpp[sessionid]=1293032648063_751683&cpp[replay_id]=&cpp[flash]=10

Other articles in this section:

  1. Explanation of Files
  2. Code Switches
  3. Disabling the Code
  4. Alternate Directory Structures
  5. Separating Files by Type
  6. Separating Files by Environment
  7. Hosting the Code from a Third Party Domain
  8. Changing Survey Behavior
  9. Using Tag Managers
  10. cxReplay Sampling & Pooling
  11. Testing Outside Production
  12. Flash and DHTML
  13. Customer Passed Parameters (CPPs) (current article)
  14. Minimizing Cookie Size