Testing Web SDK

Overview of Testing Instructions

Before releasing new or updated survey settings to production, it is critical for your team to perform testing and QA to ensure proper behavior on your site.

Here are the main testing steps:

ForeSee Code Snippet

For the initial installation of the ForeSee® Web SDK, refer to the Cloud Deployment article.

As part of the installation, ForeSee provides you with a staging code snippet that can be used for testing. This code snippet can live in your testing environment in order for you to thoroughly test any changes prior to promoting them to your production environment. The staging snippet, used in conjunction with the administration page below, gives you all you need to test your specific code configuration.

The Staging URL's

Either one of these URLs work for most clients. Clients new to ForeSee as of February 7, 2017 are using the "gateway.foresee.com" snippet below.

  • //gateway.**foresee**.com/sites/[sitekey goes here]/**staging**/gateway.min.js
  • //gateway.**answerscloud**.com/[sitekey goes here]/**staging**/gateway.min.js

Example of a Staging Snippet:

// DO NOT MODIFY BELOW THIS LINE *****************************************
;(function (g) {
var d = document, am = d.createElement('script'), h = d.head || d.getElementsByTagName("head")[0], fsr = 'fsReady',
aex = {
"src": "[//gateway.foresee.com/sites/[your sitekey]/staging/gateway.min.js]",
"type": "text/javascript",
"async": "true",
"data-vendor": "fs",
"data-role": "gateway"
for (var attr in aex){am.setAttribute(attr, aex[attr]);}h.appendChild(am);g[fsr] = function () {var aT = '__' + fsr + '_stk__';g[aT] = g[aT] || [];g[aT].push(arguments);};
// DO NOT MODIFY ABOVE THIS LINE *****************************************

Ensure the Code Snippet is Correctly Installed

It is important to be sure that the entire tag is included without mutation, and that it is placed within the section of your pages. The tag can be deployed directly on the website, or through the use of tag management tools such as Tealium, DTM, etc.

To verify that a tag is included, you can use your browser's developer tools. Examples here use Chrome, although similar tools are available in other browsers.

Testing steps:

  1. To view the developer tools, press F12 (opt + CMD + I for Mac).
  2. Navigate to the Sources tab (1).
  3. In the left pane (2), locate either:
    a. gateway.answerscloud.com
    b. gateway.foresee.com
  4. Expand that source (the name varies depending on the version of your current ForeSee code).

Once you have located the ForeSee code source in your developer tools, you can use this information to verify that the correct tag has been placed for the environment.

Expand the gateway source and view the contained folders.

You should see one of these two folders:

  1. CLIENT_ID/staging
  2. CLIENT_ID/production

The CLIENT_ID value is a unique name assigned to your code package and (typically) closely mirrors your company’s brand name. However, the folder that follows the client ID (/staging or /production) is critical; please be sure the correct folder is shown in each environment: use staging in pre-release environments, and use production on client/customer facing platforms.

When ForeSee makes future updates to the code, these updates are pushed to the staging snippet first for pre-release QA. Only after changes have your approval are they then promoted to your production snippet. Therefore, it is critical that the staging snippet is not used in production environments.

Testing Tool - Survey Administration

The triggering code embedded on your site comes pre-configured for the business rules related to your production environment. This could potentially make testing difficult. Therefore, in order to receive the invitation/survey while testing, a Survey Configuration Testing page (Figure 1) is provided which allows the invitation to display at a frequency of choice for the testing session only.

A further explanation of the rules that can be configured in the testing tool is found in the Invitation Behavior article.


Note on the Testing Tool

Using this testing tool does not change the Sampling Percentage in the JavaScript code and therefore doesn’t affect site users. Please keep in mind that when cookies and cache are cleared between each test, it may be necessary to navigate back to this test page and reset the increased sampling parameters.

To access the Survey Configuration page, simply add the hash #fscommand=fstest to the end of any URL of your site, and then refresh the page. For example, if your site is located at http://www.site.com, you would append the address to read http://www.site.com#fscommand=fstest, press enter, and then refresh the page. An example result is depicted in the screenshot below.


Figure 1