Hi Max, that application would actually solve my problem as well. I tried to use that code with a fraction of an hour in order to get it to refresh after 30 seconds, but it didn’t work. Can you provide an adaptation for that to work in a shorter time interval?
Hi there, @Fyzical_Therapy ![]()
We’ve slightly adjusted your script in the Custom JS field and now the rest should occur every 30 seconds:
const WIDGET_ID = '03b9cb00-0ab6-41af-bcb6-3efa8ce9af9b';
const LOCAL_STORAGE_SELECTOR = `SpinningWheel.winningRewardId.${WIDGET_ID}`;
const SESSION_STORAGE_SELECTOR = `elfsight-spinning-wheel-${WIDGET_ID}`;
const RESET_AFTER_HOURS = 0.0083;
const waitForElement = (selector, root = document) =>
new Promise((res) => {
let i = 0;
const check = () => {
const component = root.querySelector(selector);
if (component) {
res(component);
} else if (i !== 50) {
setTimeout(check, 100);
i++;
}
};
check();
});
waitForElement(`.elfsight-app-${WIDGET_ID}`).then(() => {
const lsValue = localStorage.getItem(LOCAL_STORAGE_SELECTOR);
if (!lsValue) {
sessionStorage.removeItem(SESSION_STORAGE_SELECTOR);
return;
}
try {
const parsedValue = JSON.parse(lsValue);
if (
parsedValue &&
typeof parsedValue === 'object' &&
typeof parsedValue.value === 'string' &&
typeof parsedValue.timestamp === 'number'
) {
const currentTimestamp = Math.floor(Date.now() / 1000);
const timestamp = parsedValue.timestamp;
const resetThreshold = RESET_AFTER_HOURS * 60 * 60;
if (currentTimestamp - timestamp >= resetThreshold) {
localStorage.removeItem(LOCAL_STORAGE_SELECTOR);
sessionStorage.removeItem(SESSION_STORAGE_SELECTOR);
}
}
} catch (e) {
console.error('Error parsing localStorage value:', e);
}
});
Please check it out and let me know if it helped ![]()
Thanks Max!
Does this only work with an embed though? It doesn’t seem to work when I use the share link - https://03b9cb000ab641afbcb63efa8ce9af9b.elf.site
The code should work with the Share Links too. I’d like to note that the reset occurs only if you reload the page.
I’ve tested your share link and everything worked fine. Could you please check it?
I see now, OK thank you!
You’re always welcome ![]()
This is not working for me. Has anyone had success?
Hey @John_Guccione ![]()
I just checked your widget, and I noticed that some lines from the script were missing. I copied the provided script once more into your widget, and it worked alright on my end this way ![]()
Please check if it’s working on your side by following these simple steps:
- Spin the wheel to get a prize.
- Wait 30 seconds.
- Refresh the page.
- Watch the Spinning Wheel be active again

Let me know how it worked for you!