Creating Launch Rules for Special Pages

Last update: 2023-05-31
  • Created for:
  • Beginner
    Developer

In addition to the data that goes in on every page, you will have some data that just needs to go in on one page. This video shows you how to merge that data with the every-page data and send it into Adobe Analytics.

 Transcript

Hey, this is Doug. In this video, I want to talk to you about creating rules in Launch for special pages. So, in other words, not a default page-load rule, but another page-load rule. So for example, when something happens on your site and you want to trigger a page-load rule or you want to set some variables on the page in addition to the default ones that are happening. Right, so these happen every page no matter what. But what if you have a page where, in addition to the default stuff, you also want to set another eVar or an additional event or something like that. Well, in our case, we’re going to go back to our site here and we have this search bar right up here, and so when you search, we want to be able to capture that search term in an eVar and we also want to set an event that says we searched. Well, we want all the basic stuff too, like the page stuff, but we also want to add that stuff. So, how do we do that? Well, let’s create a rule to do exactly that. Now, this is where it comes into why we set this one at DOM Ready 60, because we’re going to add a rule, and we’re going to want this one to actually run before the default page-load rule. And the reason is because we’re not going to send a beacon with this one. Cause we don’t really want to send two beacons. We want to set the variables, and then send the beacon with the default page rule. So, in this one, we’ll say, search or you know, search happened. Search- maybe we’ll put search results page load. And we’re going to say DOM Ready, we’re going to say 50, which is the default. So, just again, so we know when that’s going to fire. Okay, so we’ll click add the event. And we’re going to go down and do DOM Ready.

And, again, we’re going to leave that at 50 since our default page-load rule is 60. This’ll run first. Keep the changes. Now, we do have conditions on this one, of course. It’s not going to run on every page, so click add. And there are a lot of things you can do here, of course. So first of all, the logic type is either regular, so run it when this happens or run it all the time except for when this happens. So we’re going to leave it as regular, so only run it when it meets the criteria here. So, again, core extension’s fine. And the condition type can be lots of different things, a cookie has a certain value, a variable has a value, you’re on a certain landing page. You know, any of these other things like this you can browse down through and I’ll let you look at it. But what we’re going to do is we are going to go down to the bottom. We’re going to go down to the Query String Parameter. Because we know when somebody searches, it sets a Query String that has the Q parameter, so we’ll simply set that up here. Parameter named Q, has the value of what? Well, what we’re going to do, we really want any value. So, we will use Regex, and we’re going to say .+ Now you can go test that etc. But it basically just means a dot is any character and a + means 1 or more. So just you know, as long as it has anything in the Q parameter then it will fire this. There are certainly a lot of ways that you could do things like this. So if you have a better, more fun way, whatever more efficient way I should say, then of course do that but anyway this is just an example. So, keep changes. This will only run when there’s a Query String Parameter, could’ve named that more specifically but that’s fine. And we are going to add an action. So what do we want to do? Well we want to set some analytics variables, so we’ll go to Adobe Analytics and we will set variables. And this is where we can jump back to our SDR and we can look at what is it we want to set again, “I forgot”, on search, right? We want to set event2 in our search page rule, and we want to also set eVar3 to the search term. Right, so we want our search term, we have already put that into a data element, okay? We’ve pulled that off of the Query String into a data element so that’s there and waiting for us. So we just need to grab that data element, push it into eVar3, and set event2. Great. So event2 while I’m thinking about it, scroll down, we’ll set event2. Okay. And we’re going to set eVar3 Okay to the search term, there it is. Search Term! Select. So set eVar3 to the search term. Set event2 and we are good to go. We’re going to keep the changes.

Now again we’re not going to send a beacon. I could send a beacon here, but we don’t need to do that because we’re going to run this, set the variables, and then the other rule, the default page rule, is going to run, set other stuff, page stuff and then it will send the beacon. So it’ll grab all the stuff, put it all together and send the beacon. So lets try it out. Lets go to “Save to Library and Build”. That runs, okay, get my mouse over this it says- Yup! Ran successfully. Now we can go back to our site. We can bring up the debugger and we’ll just clear out what we’ve got there and I’m going to run this page again, the default home page. Lets put this to the left so we can see that debugger. We’ve got our page name, we’ve got eVar1, we even have event1 there but we don’t have event3 because we haven’t done a search yet. So if we go back over here and search “Jackets” yeah sounds good, jackets. Go. Brings up the search results page, we have our hit here and we have our search results page, search results section, and now we have eVar3 with our search term. And if we look down at our events variable we have event2 which is the search, event1 which is our page view event. So it knows to put both of those in there, put a comma between them, and that’s the exact right SIM tax to send in multiple events on the events variable. So we are good to go here and we’re done. So if you have certain pages that need to run only part of the time, I suggest that you do it this way. Just run them before the default page rule. Don’t send a beacon. Let the default page rule send the beacon. And then validate that to make sure that the variables that you are setting in that one are going in, along with of course our default stuff here as well. So there you go and good luck!

On this page