7: Conditions

 

 

 

  • Lesson Overview

    This comprehensive course covers everything you will need to become a Manage power user - from deploying tags, data layers and event tracking to organizing your TMS strategy and properly QA and troubleshoot.

    Learners should have a basic grasp of client-side web technologies.

    Transcription

    Welcome back to the Ensighten Manage Training series. In this video, we'll take a detailed look at conditions and how they're used for tags and other elements within Manage. As a refresher, a condition is how we determine where a tag can fire and occasionally when as well. You'll recall the general conditions UI from our earlier tour. Here, we see all existing conditions as well as a couple that look different from the others. These two orange conditions come with every account by default and cannot be edited or deleted. As their names indicate, they're for firing generically on all pages in either a synchronous or asynchronous fashion. These two are only applicable when no other conditions are applied to the tag. And in fact, will remove other conditions if either of these two are applied after another condition was applied.

    We see a few sorting options here and more importantly, many options to search and filter. The name search, searches entries in the name column. Condition ID is a hidden value that you'll find in a conditions details view that we'll be showing later. Data definitions and events will be covered in a future video, but for this context, the search looks for any conditions requiring matches on those items by their names. Labels are an organizational tool only inside of Manage specifically useful for search cases like this one. State for conditions is searching conditions by used or not used, and URL is an easy way to find all conditions that might match a page URL. Name is self-explanatory, but URL is not only the second most common in use, but very helpful if you're either forgetful or not the only user creating conditions. If you're not sure whether it's already conditioned for the page, you need to deploy a tag to, the URL search is your go-to search option.

    If I mouse over an individual condition, you'll see a few options pop up here on the right side. Choosing the eye symbol will bring me to the details view I mentioned before. Here we can see all information available about the condition. Important items of note here are the criteria and tags boxes, as well as the ID up in the top bar. That ID is the condition ID used in searches, as well as the ID used in delivering code files that we'll cover when we get to the debug and QA topics. Back on the main screen, if I click on the add condition button, we'll head over to the create and edit UI. On the left side, we'll see tabs covering all the matching options for condition setup. Set URL matches various pieces of your page URL. Geographics filters on the user's browser listed country location, but only for HTTP pages. Date and time settings help you fire a tag only during certain days of the week or hours of the day. Browser data lets you restrict a tag to a certain browser type or IP address. And data lets you fire a tag if some variable or data is matched on the page. URL matching is by far the most commonly used of the options with data coming up second, and being the focus of a later video. So we'll focus on URL matching for now.

    Matching on-site URL is a straightforward ask with some potentially complex gotchas. I'll come back to this top field in a moment. First, let's talk about these three. Protocol, host, and path are the fields you'll be populating most often, and at least one of these three should always have a value for your conditions. Matching options allow for various versions of string matching and their negatives, as well as the option to build your own regular expression match. Speaking of regular expressions, if you're not familiar or comfortable with using them, I'd advise you take the time to learn as they can be tricky but very powerful. You'll also find that a helper option is available to you in that field that we skipped above. By placing the URL of your page into this generate from URL field and clicking generate, the fields will automatically be populated with an exact match regular expression and the matching options will be changed to matches RegEx. This is an exact match aside from any case sensitivity. So, if you were hoping to catch any URLs that contain to the one you provided, you'll have to modify it a bit. For example, if I wanted to link to the Ensighten training site, but only have the URL for the Manage series, I could let it generate and then remove this ending section of the path. However, if I leave these symbols at the beginning and end, then I'll still be performing an exact match. By removing these, I'm now matching on any page that contains the exact protocol and host, but also loosely matching where the path contains the /training/stub. This covers the Manage series and all of the others available under the training section of the site.

    Below this trio, you'll see options that match on query parameters and hash fragments. These are elements that you typically have less reliable control over and something I personally try to avoid matching on. But the configuration for either works the same as the above three. At the bottom, you can see another hyper field. This one allows you to test one or more URLs against the matching criteria you've created for the condition. As you can probably guess, green means the condition would match the provided URL, and red means it would not.

    There's one more case for conditions. Normally, they're applied to tags directly, but it's also an option to set a condition as what's called a mandated condition at the space level. These conditions can be applied through the space's UI on the edit screen. A mandated condition is automatically applied to every tag in the space and cannot be removed from that tag by any means. These are great to use when you want to be 100% certain that every tag in a space must satisfy the condition before it evaluates its own individual conditions. When we walk through the other sections of the UI, especially tag creation, you'll see conditions pop up again, but for now, we're done here and moving on to one of the biggest topics we can cover in this series, the tags UI and tag creation.