Developer Console Commands

This page describes common commands used in the browser developer console that may help understand the code through the execution process.

📘

Testing Tools

Tools used are Chrome with Developer Tools (CTRL+SHIFT+I or F12). Internet Explorer, Firefox, and Safari all have similar Developer Tools for testing.

How do I know the ForeSee® Web SDK is being loaded?

  1. Go to your site and open the developer tools.
  2. Go to the Sources tab, and then the Network column.
    You should see gateway.foresee.com (gateway.answerscloud.com if using an older snippet).
    You should also see the version (e.g., 19.6.6), sitekey (e.g., berkshirenash), and environment (e.g., production).
14931493

What is being stored when the code is running?

FSR.Storage.all(console.log);
This returns all items in storage, including CPPs and total page views.

📘

FSR.Storage.all and the 4c cookie

Everything collected in FSR.Storage.all(console.log) gets compressed and stored in the 4c cookie. FSR.Storage is in memory only and disappears when page navigation occurs. In order for the data to persist (which is necessary for some of the data), it must either be stored in local storage, in a cookie, or on ForeSee servers. In this case, the data is being stored in a cookie.

FSR.Storage.get("cp", console.log);
FSR.CPPS.all(console.log);
This returns CPPs collected up to that point.

FSR.Storage.get("pv", console.log);
This returns total page views up to that point.

Can I force the invitation to show on the page?

FSR.showInvite();

What are my code configurations?

FSR.getConfig(); - raw data
FSR.getConfigFormatted(); - formatted for easier reading.

What are my Replay code configurations?

FSR.Record.getConfig(); - complete record configurations.
FSR.Record.getPIIConfig(); - display masking rules applied to current scope.

What survey definition am I currently on?

FSR.getConfig().active_surveydef;
Returns information about the current active definition.

Can I get the status of the invitation presentation? Has it been shown, accepted, declined?

FSR.getState(console.log); - This command returns the invitation status with a few other items.
If the didInvite parameter returns false, the inviteSituation is undefined.
If the didInvite parameter returns true, the inviteSituation returns whether the invitation was Accepted or Declined.

If you want to use the inviteSituation to programmatically prevent another overlay from presenting, run the following function:

FSR.getState(function (s) {
window.fs_state = s;
});

Then run: window.fs_state.didInvite (returns 'true' or 'false')

If 'true', then run: window.fs_state.inviteSituation (null, ACCEPTED, ABANDONED, DECLINED)

How can I tell when I will be eligible for another invitation?

expiring (value x in the storage)

Manually see a date stamp by using: new Date(1507734613339)

This gets the expiration date of the "i" value only (invitation status):
FSR.Storage.all((x)=>console.log(new Date(x.i.x)));
FSR.Storage.all((x)=>console.log("Expires on:", new Date(x.i.x)));

Using the Survey Administration Page

The following command brings up the Survey Administration page.
FSR.test();

Reset everything and test again

Instead of clearing browser storage, cache and cookies, just run the following command:
FSR.clearState()

If you are testing the appearance of a Feedback badge, use the following:
FSR.clearStateFeedback()

How can I prevent the invitation from showing for me during my workday?

FSR.optOut()

To get to the Opt-out page:

Open developer tools, type FSR.optOut() into the console, and
Or
Add /#fscommand=fsoptout at the end of the URL string, , then refresh the page.