In this video, we go through the steps of implementing internal site search variables for Adobe Analytics using Experience Platform Launch, including search term, number of results, and others.
Hey everybody, it’s Doug. In this video, I want to show you how to implement internal search variables when you’re using App Measurement and you’re using Experience Platform Launch. And I’m going to start here in the Business Requirements Document the BRD, and we have defined what we want to track. And I’ve got these items up here that we’re going to start with. We want to track these things for sure. And then we can track some other things if we want to too. Once we know how to do these up here then the rest of these are easy. You just put them in additional eVars or trigger additional events, et cetera. So, we’re just going to do a few of these things up here, and then you can use that method to add additional values down here. So once you’ve got the business requirements documented here, step one is really to go into this variable map or go into your Solution Design, your SDR and start documenting exactly how you are going to implement those. So, you can see here that, for example, for eVar10 since that’s going to be our search term I would put that here. I can then put for example where are you going to get the data from what variable on the page, et cetera, the name of the data element you’re going to put it into in Launch and the rule you’re going to use in Launch to set variables and or send the data into analytics. So again, yeah, fill those out for everything you’re going to track. Let me just click back over to the requirements and let’s take a look and launch to see how we can actually implement these items up here.
We’re going to set eVar11 the same way, set that from the number of search results, right? So I just selected the data element number of search results. And then I triggered event four, which is what I set aside for yes, there was a search. Now you can see there’s no List Var here. There’s no spot for that. So, we’re actually going to use some custom code because once again, if we go back over we want to set the filters into List Var 1.
So, we go to open our editor and we basically just look at the filters data element by using _satellite.getVar. And we put it into S.List1.
So, List var 1, okay. So let me cancel out that. So that all runs when there is a search when that q parameter has something in it. Let me cancel all of that and cancel out of that one. And then I have a zero results search as well. So, if there are no results then we’re going to set this variable to zero. So, you’re going to have to talk to your web developers and have them set it to zero or whether that’s the string zero or just a zero number or however they’re going to do it. But for this example, if I click in here, you’ll see again this is just running on DOM Ready? And it’s saying, yes when there’s something in the q parameter like before and if I click into this one, the number of search results has zero, the word zero in it. So again, you’d have to see what on your site is happening when there are zero search results. And you could use something like this as the condition type of value comparison. And so, I’m just saying, you know if this is set to this word zero then it means there were no search results. Then that means it can run this one down here. So, this action is to set variables for analytics and we are setting event five. Like we defined over here, even five in an unsuccessful search or a bad search or what are you going to call it. So again, those will run when those items have been found true, right a Query String Parameter q and it matches zero results. So, let’s take a look at an example and I’m actually going to go over to the site here and I’ve got my debugger here and ready to go. And so, if I click back and again remember I kind of had everything in a query parameter so it would be easy to test here. I’ve got my q value. So, it is searching for the word pants and results equals zero. Actually, let’s do this first time. Let’s say five results happened from searching for pants and that the filters chosen where just some random value here zzz. So, when I run this and say, reload that, oh and that reload at zero, that’s fine. Let’s look at that one first. So, we can go into our debugger here and we can see as we scroll down that eVar10 was pants, right? That is a search term. eVar11 is the number of search results, which is zero. And because there were zero search results not only we did, we have an event four which is for any search, but we had also an event five which was a zero results search. So, if we change the results, for example if I try that again and hit five then enter and go back to our debugger, then you can see that again we searched for pants. That time we had five results. And so, we only had event four, which is any search. Did not have event five this time because there were actual results. Anyway, I know that was a bit lengthy but I hope that helped to walk through some of the steps in Launch to track internal search. Good luck. -