Code File Library - Separating Files by Environment

If there is a need to have a different ‘files’ path based on the environment, add them under the ‘sites’ declaration. The code example below shows how this can be done.

The code uses a regular expression string match so there is no need to call out each environment if the ‘files’ paths are the same. Also, the sites declaration is evaluated from top down, so be careful not to add something that will match unexpectedly first.

Example (no www) would match before

The scripts below must be modified in each of the following files:

  • foresee-alive.js
  • foresee-test.js
  • foresee-tracker.js
  • foresee-trigger.js
  • foresee-qualifier.js (if applicable)
var $$FSR = {
    // {omitted code}
    'pools': [{
          path: '.',
          sp: 100 // CHANGE ONLY WHEN INCLUDING Replay
    'sites': [{
          path: '',
          domain: '',
          files: '/scripts/prod/foresee/',
    }, {
          path: '',
          domain: '',
          files: '/scripts/qa/foresee'
    storageOption: 'cookie',

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 (current article)
  7. Hosting the Code from a Third Party Domain
  8. Changing Survey Behavior
  9. Using Tag Managers
  10. Replay Sampling & Pooling
  11. Testing Outside Production
  12. Flash and DHTML
  13. Customer Passed Parameters (CPPs)
  14. Minimizing Cookie Size