-1

I have two customer types for our business and we have two websites, but both customer types come to our primary website. I'd like to take the one type of customer off of that website as soon as they hit it based on a self-selection on a popup and continue to redirect them every time they try to go back to it. We have a Wordpress website and do not log in users, so I'd like to use a cookie to redirect them, but don't want anyone stuck in a loop.

What I want to do is have a popup appear when they first visit the home page, or if they don't have the cookie on their machine and show them pictures of the two customer types and have them click on the one that they match. For simplicity, I'll say the two types are Boys and Girls. If they pick Boys, I want them to proceed to the site normally and not get the popup on any return visits. If they pick Girls, I want them to go to our other website and every time they try to return to the "Boys" website, I want their cookie to redirect them to the "Girls" website instead.

Is there a streamlined way to do this? My biggest concern is keeping anyone from ending up in a loop as many of our customers may have cookies disabled by default and may not have access to change that setting themselves.

GW3
  • 1
  • If "many of your customers have cookies disabled", then why would you want to create a solution based on cookies? – bassxzero Sep 25 '17 at 16:52
  • What if someone accidentally clicks the wrong choice? What if there are 2 people in 1 household (shared PC) that use the other site? This type of redirection I think would cause more issues than it would solve. – GrumpyCrouton Sep 25 '17 at 16:54
  • I'm open to other ideas. Basically, 85% of our traffic should be driven to the other website (Girls in my example), but they refuse to bookmark it or go to it directly. These are primarily a non-tech savvy audience and would be hard to give instructions to do anything other than googling our business name and getting to us that way each time. – GW3 Sep 25 '17 at 18:31
  • Also, cookies would probably work for 90% of the audience, but the other 10% are not tech savvy enough to enable them, or prevented from doing so by an IT rule in place at their business. – GW3 Sep 25 '17 at 18:32

1 Answers1

0

You could store cookies depending on a choice using https://www.w3schools.com/js/js_cookies.asp but make sure you allow users to go back to original page and remove cookies by doing so.

You can attach a function to save cookies like this <button onclick="myFunction('home')">Click me</button> Check this example on how to check if cookie exists: check cookie if cookie exists

myFunction(where) { // to be added to onclick to the button on the 
   homepage and button that leads to homepage on the other page you redirect to
  if (where === 'home') {
    saveMyCookie(); // save your cookie as per link provided
  } else if (where === 'otherPage') {
    removeMyCookie(); // add timeout in the past to your cookie
  }
}

And on homePage you can add something like:

 if (myCookieExists) { // use same function to check if your cookie exist
    window.location.href = "http://newpage.com";
 }

I think this should do as you expect but I highly recommend to re-think user experience in such an approach. If 80% of your customers are going to that page anyways why you don't make that the landing page and offer a redirect to less used page.

Tom
  • 349
  • 1
  • 7
  • I'll give this a shot and then report back. If I understand correctly, you are suggesting that having them check a box to "remember my choice" when selecting would be the better option for a user experience model. – GW3 Sep 26 '17 at 18:31