by Dave | activecampaign
Active Campaign conditional redirect.
In this video, we’re going to cover how to do a conditional redirect based on the drop down selection in your Active Campaign native form. Now, there’s two scenarios to be aware of.
One is when your drop down selection has one word selections, or multiple word selections, the one word options pretty darn straightforward, the multiple nuts so, and the multiple is probably the one you’re going to run into. Now I’ve got a link there, that goes to some code that I’m going to share momentarily that’ll help that, but we’re going to cover both of those scenarios.
However, if you’re already using Gravity Forms on your site, they have a built in solution. They can do conditional redirects based on form fields. So I would encourage you to use that. Otherwise, let’s dive right in.
Now, this isn’t the first time this questions been asked. Here’s a response for Active Campaign that shows you exactly how to do it and this is what we’re going to do and if you notice the red lines, they point to the redirect page, which is a drop down and then on submit, you want to send them to somewhere, notice there’s a custom field inside the URL that you’re sending to and then this goes on to give more details about this thing, how to do this and different options but let’s go ahead and show you exactly what to do.
So to start with, the biggie is we have a form that has a drop down with multiple options and based on their answer, we want to redirect to a specific page. So I’m going to go ahead and go to form, actually I want to go to list first and create the custom field that we’re going to use. And I can do it here, but I want it to be generic for everyone.
So let’s go to Manage field, and I am going to add a new field, it’s going to be called level and we want to make it a drop down and I’m going to have four different options, I’m going to have first and notice this is a one word option, this one’s easy peasy. Second, third, and then finally the best and this is a two word option. I’m gonna go ahead and add that and now I want to use that when I create a form.
Importantly, I want to make sure that I send them to a URL depending on their answer. Now I am going to make sure we don’t have to do opt in confirmation and I want to send them to this page here, or this site here and what I’ve done is I’ve created there’s the first page, there’s the second page, etc. So let me just copy that URL, as is go back to here. I’m going to paste that in.
Now I want to replace the second with the appropriate code, so that I can have that replaced. So let’s do that and I’m going to cheat and go back here without you seeing anything, right I’m managing the fields and really what I want to do is I want to get this, so it’s percent level percent. Now back to the form, where it says second, I’m going to do percent level percent and it’s got it perfect.
So it’s going to put me on a list, no confirmation, it’s going to redirect me, and it’s going to populate percent level percent with whatever I’ve selected. So let’s go ahead and integrate that and for testing purposes, let’s just do it right here and make sure it goes to the right place. There, so went to the first, let’s try that again, we know it’s going to work on second and third. So let’s be sure and then want to try the last one, which is the best.
So there I went to the right place and for the best. Now that worked properly but let’s say I’ve got a different answer and I want to go to a page that isn’t named exactly now this I don’t really like it’s got that percent 20 in there and yes, it did work. But what if I have it, we want to go to a page that’s not represented on my drop down. So a more realistic would be something like this.
So I’m going to modify my drop down menu and instead of First, I’m going to say Gold, Silver, and Bronze, and I’ll leave the best there, but I want the gold to go to the first page. Go ahead and save that. Now I’m gonna have a little problem this time, I’m going to refresh this and I’m going to go to Gold. But really, I wanted to go to the first page because this one doesn’t exist. Oops.
So now this is where I have to get a little bit tricky. So if what I showed you already works, great, you’re done. If you want something a little more advanced, here’s what you need to do. So instead of let’s go back and edit this, I want to do something like this. Now I need to create a script on my site that will handle this. So as an example, I’ve created this script right here and I’m going to paste this into my site and make the appropriate modifications.
So I’ve got the copy that, I’ve created a file in this directory called redirect on my site, it’s index.php, there it is right there. Now this time, somebody goes to Gold, I want them to go to my site and similarly for the other pages, and this doesn’t mean I have to redirect them to my site, I can redirect them wherever I want and this will be Silver, and this will be sorry that’s going to be Bronze over here and this will be third and I do need to handle the best.
And you know what, we’re going to start with the best and change this to the best. This may or may not work because of that. Now one thing I need to do is I need to lower case this string to lower and I will update that other code reflect that and this time, I want to go to its the redirect directory and I want to do Q equals redirect. So this is what it looks like. I’m just going to paste it I’m just going to show you.
I’m going to put it at the end so you can see what it looks whoops, that’s not it. Let’s copy that and let me just paste it there just to show you. So it’s the redirect directory, question mark Q, because that’s what I’m sending over and it’s going to be this right here. Sorry, we’re not gonna let me get rid of that. That’s not right. So good thing I did that because what I want to do is this.
There, so that’s the appropriate code. Now, this is your where you install the script on your site, then we put the Q equals question mark percent level, in this case, I’m gonna get rid of that, save that and make sure this is right. Go to the front, go to the back looks good. I’m going to go ahead and save this.
Now, from your perspective, it should look the same. But you know what I’m going to do, let’s send Gold, just the homepage. Let’s change that a little bit so you can see that it’s actually working and I’m going to go here, copy that go to here. This time, when I select gold, I’m going to go to the homepage. There it did. So that’s how that works. Now the one that might be a little bit tricky is the best because I don’t know how that white space is going to get handled.
Alright, it worked. So this code here with a little bit of modification in just a second is what you want to use for the more complex version.
So that’s how you do a conditional redirect with Active Campaign.