fourscore icon indicating copy to clipboard operation
fourscore copied to clipboard

Have it create a unique localstorage FS cell for each survey

Open ghost opened this issue 10 years ago • 2 comments

I've found an issue where the localStorage of fs-cell remembers the selection from a previous sentiment survey. This is even after I created a new google form and used a different account. Would be better if they expired or we could add in the URL of the source into the fs-cell and it checked to see if it was talking about the same survey. Can then have multiple fs-cells in local, each related to a different survey, depending on how many of these things I want to create (lots!).

ghost avatar May 30 '14 06:05 ghost

My hack (just to get it working) was to put a bit of code into fourscore.js. This adds a new local storage item "career" to track a specific sentiment tracker and deletes the existing fs-cell on the first load of the new sentiment tracker. Obviously, not robust.

  1. At the top

    if (localStorage.getItem('career') === null) { localStorage.removeItem('fs-cell'); }

  2. In the

function submitted(x,y,config) {

try { //Big random number into localStorage to mark that they submitted it localStorage.setItem('fs-cell',JSON.stringify([x,y]));

 //Hack to make it track each sentiment tracker. Needs to change each time
 localStorage.setItem('career', 'career');

} catch(e) {}

ghost avatar May 31 '14 10:05 ghost

I think the best way to handle this would be to make the cookie name an option in the config. I'll fix that.

veltman avatar Jun 09 '14 15:06 veltman