fourscore
fourscore copied to clipboard
Have it create a unique localstorage FS cell for each survey
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!).
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.
-
At the top
if (localStorage.getItem('career') === null) { localStorage.removeItem('fs-cell'); }
-
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) {}
I think the best way to handle this would be to make the cookie name an option in the config. I'll fix that.