Classification Rules

  • Updated

Manage scripts and cookies with Osano's CMP auto-identification feature. Ensure compliance by classifying each tracker based on its functionality. Follow our guide to add Script or Cookie Classification Rules from scratch in the Consent Manager, enabling efficient grouping and classification.

 

Identifying Trackers (Scripts, Cookies, Iframes)

After inserting the Osano.js into the <head> of your website, the CMP will begin identifying the full URL of the scripts and cookies attempting to load on your site. 

For the sake of compliance, each script and cookie should be classified as one of the following: Essential, Marketing, Analytics, Personalization, Blocklisted. (See " Classification Categories" for more info on these classification types.) Once classified, your users will be able to opt into and out of non-essential scripts and cookies based on their category. 

Generally, any script or cookie that is required for your site to function (including navigation, scrolling, animations, content loading) should be classified as "Essential." Essential scripts will always be loaded, regardless of whether the user has consented or not. You should aim to never have any uncategorized scripts.

 

Classification Rules

In many cases, you will see multiple scripts and/or cookies loading from the same domain that can all be classified with the same category. This is more common for scripts. 

Osano.com, for example, uses Facebook advertising and embeds Facebook JavaScript. Osano categorized all of the Facebook scripts as Marketing since that is their primary use. These scripts will only be loaded for users who have consented to "Marketing" cookies and scripts. We also load jQuery on the Osano.com website and a few other libraries from Cloudflare CDN, all of which are essential. Rather than categorizing each script individually, we simply tagged cloudflare.com as being Essential.

The best way to categorize these scripts is by creating a classification rule that applies to the specific domain identified. 

Classification rules are means of grouping similar scripts or cookies together based on a shared URL string. The Osano cookie consent manager accepts Postgres Regular Expressions to make classification easier to manage in the long run, however, you can also follow the examples below. 

 

Types of Rules

Exact Match:

An exact match is a 1:1 match where the rule and the script or cookie are exactly the same: 

Ex. Discovery https://www.facebook.com/cdn/marketing/pixel 

Exact Rule: https://www.facebook.com/cdn/marketing/pixel = 'MARKETING'

Path Match (Scripts and iFrames Only):

A path match involves creating a rule where the majority of the URL path is included. This would allow you to capture all content from a particular vendor up to a specific folder. (Note: it's important to end a path match with a trailing / to ensure appropriate matching)

Ex. Discovery https://www.facebook.com/cdn/marketing/pixel 

Exact Rule: https://www.facebook.com/cdn/ = 'MARKETING'

Regular Expression (Regex):

Osano supports Postgres Regular Expressions. A regular expression allows you to utilize special characters (all with specific meanings) to all match patterns when creating rules. 

Ex. Discovery https://www.facebook.com/cdn/marketing/pixel 

Regex Rule: facebook\.com= 'MARKETING'

 

Example: Scripts

You have 4 scripts that should all be classified as "Essential." 

  • https://www.yourwebsitedomain.com/cdn/scripts.js
  • https://www.yourwebsitedomain.com/cdn/themes.js
  • https://www.yourwebsitedomain.com/cdn/images.js
  • https://www.yourwebsitedomain.com/cdn/documents.js

Instead of classifying each script, I can create a "Rule" for their shared domain of https://www.yourwebsitedomain.com/cdn/ This will capture ALL 4 scripts and auto classify them as "Essential" when saved to "Managed". 

Cookie Consent - Script Rule Creation

 

Example: Cookies

You have 4 cookies that all do the same thing and should all be classified as "Analytics."   

      • _cookie_bb_123 
      • _cookie_bb_234 
      • _cookie_bb_345 
      • _cookie_bb_456 

Instead of individually classifying each cookie, I can create a shared "Rule" for them in a way that allows me to capture all 4 cookies: _cookie_bb_.* This will capture ALL 4 cookies and auto classify them as "Analytics" when saved to "Managed".  It will also auto-classify any similar cookies in the future. 

Note: It is important to note that sometimes multiple cookies from the same vendor will serve different purposes and thus will need different classifications for full compliance. 

Cookie Consent - Cookie Rule Creation

 

Adding a Script or Cookie Classification Rule from Scratch

If you already have scripts or cookies listed in the managed section: 

Scripts: In Consent Manager, from the "Script" tab, go to the "Managed" section and click the green "(+)." Insert text that is specific enough to identify only the grouping you wish to create. 

  • The Osano.js pattern matching is "greedy," meaning it looks for a match of the defined script name in the script URL on the page. Thus the script https://connect.facebook.com/scripts/analytics.js would be matched by analytics.js or connect.facebook.com or https:// - therefore it is important that if you edit the script matching pattern in the Osano CMP that you be as specific as possible, being too broad in your matching may result in scripts being incorrectly categorized or blocked.
  • The Osano.js pattern matching accepts Postgres regular expressions, but it is recommended that regex characters be used sparingly. Accepted characters are subject to change in future iterations of the product.

Once you have written and classified your rule, click save for the rule to take effect. From this point, all scripts that match the criteria will automatically fall under the associated rule. 

 

Cookies: In Consent Manager, from the "Cookies" tab, go to the "Managed" section and click the green "(+)." Insert text that is specific enough to identify only the grouping you wish to create. 

Once you have written and classified your rule, click save for the rule to take effect. From this point, all cookies that match the criteria will automatically fall under the associated rule. 

 

If there are no scripts or cookies listed in the managed section: 

If you don't yet have any "Managed" script or cookie rules, you can add them ad hoc by going to the "Scripts" or "Cookies" tab and clicking "Add Script Rule." The process will be the same as the above. 

Scripts - View Discovered

 

Creating Classification rules based on Discovered Scripts/Cookies.

You can create script/cookie rules from the "Discovered" section as well. 

Script/Cookie rules with suggested classifications can be edited inline and added to classified using the (create classification) icon. Once created, this rule will move into the "managed" section. 

Script/Cookie with no suggested rules or classifications will show "unknown" in their classification dropdown. The usage and classification of these scripts and cookies must be identified within your organization. Once identified, you can modify the classifications and use the (create classification) icon. Once created, this rule will move into the "managed" section.