Code File Library - Changing Survey Behavior

Loyalty Factor and Sampling Percentage

The behavior of the survey is controlled by the foresee-surveydef.js file located in the .zip file. The two most common parameters that may need adjusting are the LF (Loyalty Factor) and the SP (Sampling Percentage). The Loyalty Factor indicates the minimum number of pages a user must visit to receive an invitation. The Sampling Percentage indicates the percentage (random chance) of users who are invited. If asked to change this number for a survey with multiple definitions, the client must be aware of the name of the definition and check the include URLs to ensure it aligns with the survey the client is trying to change.

FSR.surveydefs = [{
    name: 'browse,
    invite: {
        when: 'onentry'
    }, 
    pop: {
        when: 'later'
    },
    criteria: {
        sp: 10, // sampling percentage
        lf: 3 // page view requirement (loyalty factor)
    }, 
    include: {
        urls: ['.'] 
    }
}];

Invite Excludes

The ForeSee code should be placed globally across all pages. However, in some cases it be desired for an invitation to not come up based on certain criteria. To suppress the invitation, page exclusions can be utilized. Page exclusions are formatted in a comma separated list based on specific URLs, referring domains, user agents, browsers, cookies, and/or variables. Each of these methods can be set up in the foresee-surveydef.js file.

Note
Excluded pages still count towards the Loyalty Factor requirement (minimum page views).

Note
Code should not be intentionally left off a page in an attempt to exclude it. Leaving code off a page may result in an early exit condition causing the survey questionnaire to present for users who had already accepted an invitation.

Tip
Rather than trying to exclude URLs individually, the client may use regular expressions, or use part of the URL that is common to a group of pages, rather than the individual page.

invite: {
    exclude: {
        urls: ['/support','/checkout'],
        referrers: ['google.com'],
        userAgents: ['Firefox/22.0  MSIE'], 
        browsers: [{"name":"IE", "version":7 }],
        cookies: [{name: '__utmc',value: '1'}],
        variables: [{name: 'testvar', value: ['1']}]
    },
    ...

Global Excludes/IP Excludes

Global Excludes are used in situations when the ForeSee code should not execute on the site. These are often utilized when clients are trying to exclude internal IP addresses or have a special user agent assigned to an internal bot checking the site. The Global Excludes can be based on URLs, variables, cookies, or user agents. It is possible to set up an exclude based on an IP address. However, this requires the IP address of the user to be collected by the site and passed as JavaScript variable. The variable containing the IP can then be added in the variable exclude with a list of IP values that are to be blocked.

Note
It is recommended to use regular expressions for the IPs if excluding a large number of them.

Tip
The parameter called ipexclude should be modified to the name of the variable used to exclude the IPs. This parameter is connected to the fsrtest.html page and allows internal testers to set a cookie overwriting the exclude temporarily from the test page.

FSR.properties = { 
    // {omitted code} 
    exclude: { 
        urls: ['/support','/checkout'], 
        referrers: ['google.com'], 
        userAgents: ['Firefox/22.0', 'MSIE'], 
        browsers: [{"name":"IE", "version":7 }], 
        cookies: [{name: '__utmc',value: '1'}], 
        variables: [{name: 'fsr$ip',
                     value: [/^141\.214\./,/^198\.(109|110|111)\./] }] 
    },
    ipexclude: 'fsr$ip',
    ...

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 (current article)
  9. Using Tag Managers
  10. cxReplay Sampling & Pooling
  11. Testing Outside Production
  12. Flash and DHTML
  13. Customer Passed Parameters (CPPs)
  14. Minimizing Cookie Size