Allow users to spin the wheel multiple times

Please add an option for users to spin the wheel multiple times

3 Likes

All I have to do is delete my web history on my device and I can spin again. How do we prevent a user from simply spinning until they win?

3 Likes

Hi @Shawn_Martin :wave:

Now, a user can spin the wheel only once. We already have a request for the multiple spins and I’ve added your comment there too.

In the meantime, could you please describe your use case in more detail? Would you like to allow your website visitors to win multiple prizes at once? If yes, how many spins would you like to set per user?

1 Like

I am looking to use this spin-the-wheel in an educational setting. I want students to be able to spin the wheel again immediately and unlimitedly. They will use it to determine what aspect of the artwork they will reflect on in a critique game. I hope you consider adding this function as an option. Thank you :slight_smile:

2 Likes

Hey there, @Katie_Pearce and welcome aboard :waving_hand:

Many thanks for sharing your use case with us! Let’s hope this idea gets traction with the community and the devs will be able to consider it :slightly_smiling_face:

1 Like

This can’t really be used in an office for example for people to win prizes without a reset button..

2 Likes

Hi there, @Fyzical_Therapy and welcome to the Community :waving_hand:

It looks like you want multiple users to be able to spin the wheel, and I see that my colleague Mike mentioned our widget works this way. The reason you don’t see a Reset button is that the widget is designed to be spun once per visitor.

If you’re looking to allow a single user to spin the wheel multiple times, this thread is just for you. We’ll update you here if any news comes up :slightly_smiling_face:

1 Like

Hi Max, just to clarify, I want to be able to have the spin the wheel on a tablet and reset it to allow multiple people to give it a try using that same tablet.. we may be saying the same thing, but just checking

2 Likes

Got you, thanks!

Yep, this idea discussed in this thread meets your use case :slightly_smiling_face:

1 Like

I am wanting to use the spinning wheel for my live stream show. However, if you place a limit on 1 user then they cannot play the game for the next live show. How about a 24 hr hold from the initial spin to allow loyal watchers to engage on the next live program?

2 Likes

Hi there, @ias_Music :waving_hand:

Thank you so much for the feedback!

While this option isn’t available in the widget’s settings right away, it’s possible to reset the spin after a specific period of time using the custom code below:

const WIDGET_ID = 'Your_Widget_ID';
const LOCAL_STORAGE_SELECTOR = `SpinningWheel.winningRewardId.${WIDGET_ID}`;
const SESSION_STORAGE_SELECTOR = `elfsight-spinning-wheel-${WIDGET_ID}`;
const RESET_AFTER_HOURS = 24;

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) {
    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);
  }
});

Replace YOUR_WIDGET_ID in the 1st line of the code with the ID of your widget and set the desired interval between spins in the 4th line of the code:


The resulted code should be added to the Custom JS field on the Settings tab of your widget’s settings :slightly_smiling_face:

1 Like

A post was split to a new topic: How to reset prize in Spinning Wheel every 30 seconds