Learn to use the Classification Rule Builder to automatically apply rule-based classifications in Adobe Analytics.
Hi there. A quick walkthrough on using the Classification Rule Builder within the Adobe Analytics. As a reminder the Classification Rule Builder is meant to help you create automatic and rule-based classifications that can be applied across multiple variables and multiple report suites. The rules are processed frequently and help you avoid having to manually upload classifications on a regular basis. If you’re able to create them based on logic or rules.
The steps are listed here within the Knowledge Base. Just simply head into the Knowledge Base and look for Classification Rules. But instead of doing that, why don’t we just go through it within this video.
The first step like with the Classification Rule Builder is to actually create the classifications based on your variables. For me I’ve created a variable called Page Grouping that’s based on my page variable within my Cross-Industry Demo Data set. Now this is an important first step within the Classification Rule Builder. That is you have to have the classifications made before you set up the rules. If you need a refresh on creating classifications, you can also head to the Knowledge Base about Classifications, or follow the video that we created on Classifications as well.
Now once you head into the Admin console, you can get to the Classification Rule Builder by clicking on Admin and going down the Classification Rule Builder here. And you’ll see a list of any other rule sets that have previously been created. In order to add a new one, you simply click Add Rule Set and give it a friendly name. We’ll call it friendly classification rules for Adobe and create our rule set. Now our rule set is going to be aligned with any number of variables across any number of report suites. Though generally you want it to focus on one specific type of variable at a time, because they will populate all of the same classifications at the same time. So the first step, once you’ve created your rule set, is to then select your report suite and variables. And so you simply choose Add and then find wherever it is that you want to classify. And so maybe we wanna classify with our Campaign variable for example. Click Save. And now the fun begins. So the reason that you would use a Classification Rule Builder rule set is perhaps if you have a bunch of different page names that you want to bucket into some more friendly, or just simply a higher level of granularity when it comes to bucketing those values. So it’s some kinda similar to a site section or a channel level of analysis, or values. You could also use it in order to create a page types variable as well. So you’re grouping your pages into whether it’s a blog post or a product page, or a category page, or something along those lines. We’ve seen other customers that are using it just simply to break out a wide variety of variables that are being passed in with a delimiter. For example, if you’re capturing within your Campaign code. You’re capturing the medium and the publisher and the Campaign name. And all of these different types of Campaign variables all within a single eVar, or within the s.Campaign tracking code variable. You could use Classification Rule Builder to simply break those out into four separate different variables on the Campaign, the medium, the publisher, or et cetera. And so what I’d like to do is show you quickly what these steps are. So you can add a rule and then you define your rule type. As it Starts with, as you would expect, starts with this rule type that says: Does your criteria within the values of your variable…
Does that start with a specific set of characters? And if so, you can then classify it. Same thing with Ends with. Does it end with a specific set of characters? And then you can set a specific classification for it. Contains is again somewhere in the middle, or the beginning or the end saying: Does the value within your variable contain something? And then Regular Expression is a significantly more complex yet significantly more powerful capability, which is using regular expressions to look for certain characters within your variable’s values in order to classify that within a more, even more dynamic sense. And so rather than sort of walk you through this manually, let me dig into a rule set that I’ve already created. So that you can see what gets populated there. So this was my page grouping here and I’m using a number of different… A mixture of Regular Expressions and Starts with and Contains. And so the way that a classification rule set works within the Rule Builder is that the priority really matters. In that for every single value that is evaluated, it starts with the top, and then if it matches that criteria, then it classifies it. And then it always goes on to the next one. If it matches this criteria, then it overwrites the value that was previously set before and continues on and on and on and on. So every single rule is always run on every single value within your variable. And it’s really important to understand that. So the priority is what is defined here. So my number one recommendation for you, if you aren’t already doing this, is for all of your classification rules to start with a catch-all. Now a catch-all is listed here where I just simply say my regular expression equals .* . And that it simply has a value of some type and then set your classification to say Unclassified and then $0. So let me walk through what that actually means. So in order to edit things, you’re actually going to have to deactivate your rule set, which is what I just clicked Yes to. And then .* simply says if any single character exists and then the star means zero or more of any single character, then the values will be captured in my match group. And the way that regular expressions work here is if it matches, then it assigns it a specific set of variable number. And so that’s a dollar sign and then a zero. Now if I were to say maybe adjust my regular expression to say within this, I could say maybe, I’ve got a parenthesis that says look for asdf and then add the .* afterwards. Then you can see that .0 always gives the full value if it matches. And then because of the parenthesis, capture everything enclosed. We also have additional match groups. So let me actually make this a little bit easier. So we’ll say asdf and then jkl, semicolon. And then you can see how all of it goes into $0. And then since there are two different sets, there’s the parenthesis over here and the parenthesis over here, they are broken out into two separate match groups. Now this is important. In just a second I’ll explain why in just a minute, but it’s important to understand just simply that that exists. And so I’m actually gonna cancel that, because I wanted to leave it as .* . And then what I’ve done is we’d go ahead and you’d say: Well what is the classification that I wanted to find based on my match criteria? Now this is important, because perhaps within my page variable, within my Cross-Industry Demo Data set report suite, perhaps I have five different classifications for that page variable. I could actually choose which of them do I actually wanna set. And for this one I only have one classification so it’s really easy. Then finally we have the last column, which is what I’m setting the classification to. And so in this instance I’m setting it to the fact that hey there’s something that’s Unclassified here, and then I’m concatenating that with a $0. So it’s returning the full value of the base variable and then prepending it with Unclassified. So it’s very easy to find. And then as an analyst I’m proactively informed oh it looks like we have an opportunity to adjust our rule set in order to classify something that is being improperly classified by Rule Builder. Now since we walked through that best practice, let’s actually then jump to the bottom and work our way up. So here we’re able to see that I’ve created a rule type of Contains where I’m looking. I’m having Rule Builder to take a look through my page variable and looking for the word subcategory. If subcategory is anywhere in my page name, then I’m gonna be setting the page grouping. That’s my bucket of pages, up to be called category. Now I could call it anything. I could call it Eric is Awesome, I could call it Adobe Rocks, but let’s actually just call it category. That way I have both category and subcategory listed as category. And I’ll explain how that works in just a second.
Next up I’m also using Starts with. And so this is any pages that start with the term purchase, I’m calling that my cart flow. Then we start to get into some crazy regular expressions that go well beyond the .* that we have in the first level as our catch-all. So let’s take a look at this first one. So this is simply saying: Find something, find any variable that has a value that has a colon in it and, or… I’m sorry, this actually says doesn’t have a colon in it, because it’s within these brackets, and if that exists, then return the value. So if we were to say our page category is purchase, then it’s going to return purchase as the result within $0. Same thing if I were to call this category. So it’s a really nice way to confirm your regular expression. As you can see it’s relatively difficult to read through them without confirming that, but it’s a really nice way to analyze this. And if I take a look at my page dimension, you can see I have all these different ways in which data is being collected. I have category 4, category 1. In fact if I do to apply a filter here on just the word category, then I’m going to see a wealth of different variables or values. And so I can take all of these. And the important thing to notice here is that any of them that have category, that I’m highlighting here and here and here that don’t have the colon, will be listed as type category. And so that’s actually what I want this to do. So I can go ahead and hit Save. And the last thing that I need to do is populate it with the value of $0. The other thing to check is since I don’t want anything that does have a semicolon, or I’m sorry, a colon to be populated there, I could even check that too. So we know category works. But if I were to say category Eric, then we can say there aren’t any matching groups, and so just simply nothing would be set for this regular expression within this rule. And the reason for that is what happens on the next regular expression. Here I’m saying: Okay, start with the section that says the same one as the previous area. The previous rule that says: Find the first section that doesn’t include a colon and then highlight the colon. And then finally anything after the colon gets populated in $2. So that’s that .* again. Since I’ve got category Eric here, then I’m saying the $0, the first variable, zeroth variable if you will, gets the full value. The first one since it’s within these parentheses is just simply category. So it’s bubbling up my key here up to category, and then Eric is returned as the $2. If we do put in Eric Matisoff, then the full remainder after the first colon would exist there. And I can put as many things here as I want to. And they would just keep populating into $2, because of the way that I’ve coded in this regular expression. Now once I hit Save, then I wanna think about: Well, what value do I wanna populate into my page grouping here? What we saw here was if I leave it as $0, then it’ll just simply return the very first, the very first match group. And that means every single value that’s populated will be returned, and that’s not what I wanted to do. I only wanted it to return the piece before the very first colon. And so that is what’s populating within $1. So within $1, if I then put that in my Classification Action for the To, then I’m saying: Populate that value there. And so that’s a relatively complicated, but trust me they can get even more complicated than that, way in which classification rules can be set out for regular expressions. The last piece that you wanna do always before you activate your classification rule set is to test it. In fact I could probably say that for anything with Analytics. Always test and QA before you push anything live. So when we test our rule set, what I’m brought to is a new screen that if you’ve previously done, it will have a prebuilt list of sample keys. And if you don’t have any keys, you can actually… What I like to do is just copy and paste maybe the top 10 or even the top 50 different items here within Workspace, and then we can maybe just copy those and paste them in over here. And then we can run our test to see how my rule set would be applied to all of the top 50 items within Analysis Workspace. Within my dimension. And so I can see all of the different ways in which my page names are being bubbled up. And that these top ones, these apps are being bubbled up to app. The app subcategory 3a, again it’s just kinda showing everything prior to the colon. Although it looks like I still have some opportunity to improve it. The important thing here is that I don’t see anything that is Unclassified. Now if I was curious. How come this app subcategory 3c is being populated in the category? I can actually hover over any rule within, or any page grouping value in order to learn why and how those different values are getting set. So you can see how each rule is being used. So Rule number 1 matches .*, so initially page group is set to Unclassified. Then with the Unclassified, then the default value, $0. Then Rule number 3 is matched, and so that is setting the page grouping to… It would be setting it to app which is $1 in this instance. Then I have Rule number 5 which is saying if subcategory is anywhere within my rule, then I actually wanna set page grouping up to category. So again then I can see how that’s getting set there. So that’s an interesting really powerful way to create priority within your rules. And what you’re noticing up here is that my category 4, category 1, category 5 and 3, those are still not getting bubbled up properly. So what I’m going to do is actually add one more rule that says: If category is contained somewhere, then I wanna set my page grouping also to category. And we’ll see that when I test my rule set now, then we’re gonna see that’s much better. So now category 4, 1, app category 2, 1, 3, all of these are listed as categories as I would expect. In fact it looks like… Oh well, I’ve got only category pages listed here. So we’ll go back to Workspace, and if I actually remove that and click Apply, no wonder that happened. Then we can perhaps add Visits as a metric, and we can take our top 50 values. Copy them and paste them, and run our test once again. And now we’re gonna see a wealth of different values getting populated from category to subscription, to app, to product, details, create account. All of these where it’s capturing either the section before the colon, which is what’s happening here within app, or if subcategory or category is set. Then it’s setting that to category as well. So I feel confident that my rules are working the way that I expect them to. So I can return to my rule set and go ahead and activate. But the one last thing you wanna think about before you activate is how far back do we wanna look at all of the values that were collected in the variables that you’re classifying. And that’s what we call our Lookback Window. And so Lookback Window by default sets itself to one month. You can go as high as six months, which means that we’re looking at the last six months of values that have been populated into your variable. And we’re gonna use those in order to create new classifications. Generally I recommend increasing your Lookback Window up to six months unless you have a reason not to do that. And so we have everything looking the way we want to. Go ahead and click Activate, and within the next 24 hours your classifications will be applied. And your classification rules will be generated based on the last six months of data. And then any new value that comes in will also go through those rules and be applied as such. So, I hope you enjoyed this video. Have fun classifying.