X
    Categories: Cool StuffInfusionsoft

Infusionsoft Hacks! Redirects upon Redirects

Hey there!

I find that many Infusionsoft users run into this problem eventually, and spend many hours trying to solve it. So here is the quick and easy solution.

WARNING! CODE AHEAD!

Want to skip the code? Buy this plugin to take care of your redirecting issues for you!

Okay, now we get to the good stuff…

I’ve been working with Infusionsoft for a year, and have found myself in some pretty sticky situations when it comes to creating automation on the cheap or in a short amount of time. Whether it’s because of Infusionsoft Limitations, other products limitations, or even sometimes the client’s limitations.

As a Certified Partner hoping to bring value to the community, I hope we can learn together and see if we can make Infusionsoft an even better service for your business. So without further ado…

Form Field Based Redirects

We have a short hack for you. This one some of you may know already.

Many of us use services such as MyFusionHelper/Zapier/Plus-This to do some simple things that could have been solved with a little bit of code but instead pay through the nose for third party services. The most simple of which is the Redirect based on Form submission.

Let’s say you have a radio button. Option 1 takes you to one order form. Option 2 takes you to a different one. What do you do???

Let’s create a page, call it name-of-campaign-redirect or something, and place the following code on it.

<script type="text/javascript">
//no need to worry about this code.
    function get_params() {
        if (location.search) {
            var URI = location.search;
            var parameter = URI.slice(1);
            var var_dict = {};
            var parameters = parameter.split("&");
            for (var i = 0; i < parameters.length; i++) {
                var temp = parameters[i].split("=");
                var_dict[temp[0]] = decodeURIComponent(decodeURIComponent(temp[1]));
            }
            return var_dict;
        } else {
            return null;
        }
    }

    function redirect_link(link){
        window.location = link+location.search;
    }
//worry about this code only
    var FIELD = ""; // the field of which you will redirect
    var OPTION_1 = ""; //option value 1
    var OPTION_2 = ""; //option value 2
    var REDIRECT_1 = ""; //order-form 1
    var REDIRECT_2 = ""; //order-form 2
 
//no need to worry about this code.
    var params = get_params();
    // this is where conditionals go

    if (params[FIELD] == OPTION_1){
        redirect_link(REDIRECT_1)

    } else if (params[FIELD] == OPTION_2){
        redirect_link(REDIRECT_2)
    }
    
</script>

Notice the following variables…

  • FIELD: the name of the field to base the redirect on, should look like inf_option_Nameoffield,
  • OPTION_1: the value of one of the options, could either be a number or a string of text.
  • OPTION_2: the value of one of the other options, could either be a number or a string of text.
  • REDIRECT_1: the URL of the redirect if option 1 is selected
  • REDIRECT_2: the URL of the redirect if option 2 is selected

Once you’ve filled out those variables, you have a functioning redirect.

So if you only have one in all of your campaigns, there’s no need to pay a monthly fee if it’s not terribly active anyways.
Once you’ve created the redirect page, you need to set the thank you page of your web form to be the redirect page you just created.

Here’s an example of how the code should appear completed. We actually use this in one of our campaigns to send people to different order forms based on whether they mark as attending a live-stream event or an in-person event.

<script type="text/javascript">
    function get_params() {
        if (location.search) {
            var URI = location.search;
            var parameter = URI.slice(1);
            var var_dict = {};
            var parameters = parameter.split("&");
            for (var i = 0; i < parameters.length; i++) {
                var temp = parameters[i].split("=");
                var_dict[temp[0]] = decodeURIComponent(decodeURIComponent(temp[1]));
            }
            return var_dict;
        } else {
            return null;
        }
    }

    function redirect_link(link){
        window.location = link+location.search;
    }
    var FIELD = "inf_option_Choosehowyouwouldliketoattend";
    var OPTION_1 = "724"; //in-person
    var OPTION_2 = "726"; //live-stream
    var REDIRECT_1 = "https://js935.infusionsoft.com/app/orderForms/2dab82fd-50e5-4050-ae17-abad2eb7a453"; //order-form in-person
    var REDIRECT_2 = "https://js935.infusionsoft.com/app/orderForms/abd43762-9b53-4504-bca1-dacc201e840b"; //order-form live-stream

    var params = get_params();
    // this is where conditionals go

    if (params[FIELD] == OPTION_1){
        redirect_link(REDIRECT_1)

    } else if (params[FIELD] == OPTION_2){
        redirect_link(REDIRECT_2)
    }
    
</script>

This method works well for custom fields, radio buttons, and drop downs. In order to see what the “actual” value of the radio button is because it’s actually a number, you may need to search through the HTML code inside Infusionsoft. But that’s not too difficult.

But for the none technically inclined, just looking at that stuff can be a headache. Don’t bother and just use this plugin instead…

Adrian Tobey :Adrian Tobey is the Director of Marketing at Training Business Pros. Adrian is responsible for planning and execution all internal marketing strategies as well as the marketing strategies for many of TBP's Clients. In his spare time Adrian produce's a software called FormLift for infusionsoft & WordPress users.