Classification rules
Classification rules regularly look for unclassified terms. If a rule match is found, the rules add the terms to your classification data tables automatically. You can also use classification rules to overwrite existing keys.
Analytics > Admin > Classification Rule Builder
The Rule Builder lets you create a classification rule set, which is a list of classification rules. A rule matches criteria you specify, then performs an action.
Classification rules are convenient for:
-
Email and Display ads: Create classification rules to group individual display ad campaigns so that you can learn how the Display campaigns are performing against email campaigns.
-
Tracking codes: Create classification rules to categorize key values derived from strings in tracking codes, and match them to specific criteria you define.
-
Search terms: Use regular expressions and wildcards to simplify classifying of search terms. For example if a search term contains
baseball
, you can set aSports League
classification toMLB
.
For example, assume that a tracking code for an email campaign ID is:
em:Summer:2013:Sale
.
You can set up three rules in a rule set that identify the parts of the string, then classify the values:
How Rules Are Processed how-rules-are-processed
Important information about how classification rules are processed.
Important Information about Rules
-
Specify group permissions for classifications in Admin Tools.
-
Regular expressions: Help is available under Regular Expressions in Classification Rules.
-
Report suites: You cannot choose a classification until at least one report suite is selected. You cannot apply the report suite until you have created the rule set and assigned a variable.
When you test the rule set, use keys (the variable being classified) from the report to see how they will be impacted by the rule set. (The key is the variable being classified, or the first column in the classification upload table.)
-
Rule priority: If a key matches multiple rules that set the same classification (in the Set Classification column), the last rule that matches the classification is used. See About Rule Priority.
-
Limits on number of rules: No set limit exists for the number of rules you can create. However, a large number of rules may impact browser performance.
-
Processing: Rules are processed at frequent intervals, depending on your volume of classification related traffic.
Active rules process every four hours, examining classification data going back typically one month. The rules automatically check for new values and upload the classifications using the importer.
-
Overwriting existing classifications: See When Do Rules Not Classify Keys? If necessary, you can delete or remove existing classifications, using the importer.
When Do Rules Not Classify Keys?
When you activate rules, you can overwrite existing classifications. In the following situations, a classification rule does not classify a key(variable) if:
-
The key is already classified and you do not select Overwrite Classifications.
You can overwrite classifications when adding and activating a rule, and when activating a data connectors integration. (For data connectors, rules are created by partners in the Dev Center and displayed in the Classification Rule Builder.)
-
A classified key has not appeared in the data after a time frame specified when overwriting a key, even after you enable Overwrite Classifications.
-
The key is not classified and the key is never passed into Adobe Analytics after the time frame beginning about one month ago.
note note NOTE In reports, classifications apply to any time frame specified, whenever a key exists. The date range of a report does not affect reporting.
Regular Expressions in Classification Rules regex-in-classification-rules
Use regular expressions to match consistently formatted string values with a classification. For example, you can create a classification from specific characters in a tracking code. You can match particular characters, words, or patterns of characters.
Regular Expression - Tracking Code Example section_2EF7951398EB4C2F8E52CEFAB4032669
In this example, assume you want to classify the following campaign ID:
Sample Key: em:JuneSale:20130601
The parts of the tracking code you want to classify are:
em
= emailJuneSale
= campaign name20130601
= date
Regular Expression: ^(.+)\:(.+)\:(.+)$
How the regular expression correlates to the campaign ID:
Match Groups: Shows how the regular expression corresponds to the campaign ID characters, so that you can classify a position in the campaign ID.
This example tells the rule that the campaign date 20140601
is at the third group (.+)
, identified by $3
.
Rule Builder
In the Rule Builder, configure the rule as follows:
Syntax
^(.+)\:(.+)\:(.+)$
em:JuneSale:20130601
$0
: em:JuneSale:20130601
$1
: em $2
: JuneSale $3
: 20130601^
= starts the line () = groups characters and lets you extract matching characters in the parentheses. (.+)
= captures one ( . ) character and ( + ) any more \ = start of a string. $
= indicates that the preceding character (or character group) is the last in the line.See Regular Expressions - Reference Table for information about what the characters in a regular expression mean.
Regular Expression - Classifying a Specific Character section_5D300C03FA484BADACBFCA983E738ACF
One way to use a regular expression is to classify a specific character in a string of characters. For example, assume that the following tracking code contains two important characters:
Sample Key: 4s3234
4
= brand names
= identifies a search engine, such as Google
Rule Builder
In the Rule Builder, configure the rule as follows:
^.(s).*$
$0
(Captures the first two characters for brand name and search engine.)^.(s).*$
$1
(Captures the second character for Google.)Regular Expressions - Matching Tracking Codes of Varying Length section_E86F5BF5C2F44ABC8FFCE3EA67EE3BB2
This example shows how to identify specific characters between colon delimiters when you have tracking codes of varying lengths. Adobe recommends using one regular expression for each tracking code.
Sample Keys:
a:b
a:b:c
a:b:c:d
Syntax
Rule Builder
In the Rule Builder, configure the rule as follows:
a:b
^([^\:]+)\:([^\:]+)$
$1
a:b
^([^\:]+)\:([^\:]+)$
$2
a:b:c
^([^\:]+)\:([^\:]+)\:([^\:]+)$
$1
a:b:c
^([^\:]+)\:([^\:]+)\:([^\:]+)$
$2
a:b:c
^([^\:]+)\:([^\:]+)\:([^\:]+)$
$3
a:b:c:d
^([^\:]+)\:([^\:]+)\:([^\:]+)\:([^\:])$
$4
Regular Expressions - “Does Not Contain” Example section_FCA88A612A4E4B099458E3EF7B60B59C
This example provides a regular expression that matches any string that does not contain specific characters, in this case 13
.
Regular expression:
^(?!.*13.*).*$
Test strings:
a:b:
a:b:1313
c:d:xoxo
c:d:yoyo
Match results:
a:b:
c:d:xoxo
c:d:yoyo
In this result, a:b:1313
does not indicate a match.
Regular Expressions - Reference Table section_0211DCB1760042099CCD3ED7A665D716
(?ms)
?i
)abc
]^abc
]a-z
]a-zA-Z
]^
$
\A
\z
.
\s
\S
\d
\D
\w
\W
\b
(...)
(a\b)
a?
a*
a+
a{3}
a{3,}
a{3,6}
A good resource for testing regular expression validity is https://rubular.com/.
About Rule Priority
If a key is matched to multiple rules, and it sets the same classification column shown in the Set Classification column, the last rule is used. As such, you might want to rank the most important last in your rule set.
If you create multiple rules that do not share the same classification, processing order does not matter.
What follows a search-term rule example that classifies search types for an athlete:
If a user searches for Cowboys fantasy Tony Romo
, the term Player
is classified, because it matches the last given classification shown in the Set Classification column.
Similarly, suppose you set up two rules in a set for the following search terms:
A user searches for Cowboys vs. Broncos
. If the rule builder finds a conflict in rule matching, the classification for the second rule (Denver) applies to this search.
Add a Classification Rule to a Rule Set add-classification-to-rule-set
Add rules by matching a condition to a classification, and specifying the action.
To add or edit a classification rule:
-
On the rule set page, click Add Rule.
-
Next to Report Suites, click Add Suites to specify one or more report suites to assign to this rule set.
The Select Report Suites page displays.
note note NOTE Report suites display on this page only when the following conditions are met: -
The report suites have at least one classification defined for that variable in Admin Tools.
(See Variable in Classification Rule Sets for an explanation about this prerequisite.)
-
You selected the report suite on the Available Report Suites page, which displays after you click Add Rule Set to create the rule set.
-
-
Specify whether to overwrite existing values:
table 0-row-2 1-row-2 Rules overwrite any existing values (Default setting) Always overwrite existing classification keys, including classifications uploaded via the importer (SAINT). Rules overwrite only unset values Only fill in blank (unset) cells. Existing classifications will not be changed. -
For examples of building rules, see Classifications Rule Builder and Regular Expressions in Classification Rules.
note note NOTE If a key matches multiple rules that set the same classification (in the Set Classification column), the last rule that matches the classification is used. See About Rule Priority above for more information about sorting rules. -
After testing, click Active to validate and activate the rule.
Activating a rule automatically builds the file and uploads it for you.
Field definitions: See Classification Rule Builder for complete definitions of interface options on this page.
Test a Classification Rule Set
You can test a classification rule or rule set. Running a test checks all the rules in a set.
To test a Classification Rule Set:
-
On the Classification Rule Builder, click the rule set name.
-
Ensure that the rule set is associated with a report suite.
-
On the rule editor, click Test Rule Set.
-
Type or paste test keys in the Sample Keys field.
Sample keys include:
- Tracking codes
- Search keywords or phrases
See Regular Expressions in Classification Rules for information about testing regular expressions.
-
Click Run Test.
Rules that match are displayed in the Results table.
-
(Optional) Click Activate to activate the rule, and to overwrite existing classifications.
See for more information about using rules to overwrite existing classifications.
Validate and Activate Classification Rules
To validate and activate classification rules:
-
Create a Classification Rule Set , then add classification rules to the set.
-
On the rule editor, click Activate.
-
(Optional) To overwrite classifications, enable Overwrite classifications for <selection>.
This option lets you overwrite existing classifications for affected keys.
See Rules Page for a definition of this option.