Learn how to create data elements to store values pulled from your data layer and make them available to rules and extensions in your tag property.
Launch is now tags
Welcome to the add data elements course. In this training we’ll explain the power and flexibility of data elements by walking through some examples.
Data elements are part of the basic building blocks of tags within Launch. Data elements store the attributes we want to send to our marketing and analytic solutions. Think of our data elements as Launch’s version of a data layer.
Data elements can store any value for any purpose that we want. But most commonly it’s used for the values of the website data layer. So just to briefly introduce or remind you what a data layer is, let’s jump over to our We.Retail site and view the page source code. So here on the homepage of We.Retail let’s jump over here to view page source.
Data layers are becoming more and more popular because they’re very stable elements of the page. Once the schema is decided on, all the web developers and content providers use it to input information about the page. Now you don’t have to use a data layer, Launch can accept cascading style sheets or other methods to pull the information from the page. But in the example of a cascading style sheet, as changes happen it will change the cascading style sheets on the page which could break your data element. So data layers are very powerful. So let’s create a data element and capture some information from the page.
Back here in Launch we want to click on our data elements tab. And if we’ve never put a data element in here then it will say create new data element.
So we want to have a good naming convention for our data elements and for that matter for everything that we name within Launch. So we’re just going to use part of that data structure here and we will call it page name.
So digital data, dot page, dot page info, dot page name with the caps on the I and the N, as well as the D. So once we’ve got that we can move onto the next thing. The next one is the default value. If there is no value found in the data element, it will use this default value. Now depending on what the value is and what the data element’s purpose is, you may want to put a default value in but in most cases we would recommend leaving this blank.
The next thing is force to lowercase. Now many times when different developers are populating data layers, they may not do it exactly the same way. So by checking this box, we’re able to ensure that at least the case sensitivity is consistent. This helps reduce duplicate values that are treated as separate values. There are times when we would not want values to be all lowercase, like capturing a user ID or something where the format of the value relies on if it’s being upper or lowercase. Now the next one, clean text, it’s simply takes out spaces before and after the value and any double spaces within the value, so it just makes it more consistent again. It’s probably a good idea to always check that. Now our last one here is storage duration. This is the length of time that Launch will store the value. And this is based on the browser, not any specific solutions session time. In 99% of use cases, we recommend choosing none. There’s usually no reason to persist the value of a data element. It’s best practice to explicitly call the data element when you want it for that specific server call. And not depend on previous values of the data element. Now granted there could be some edge case where you may find it useful to persist the value but in most cases just choose the none.
So once we’ve got this setup, we can just go ahead and click save.
Okay let’s see if we can put this value in here. In fact, let me come back here and we say; okay it’s going to be digital data and instead of using page, we’ve got to come down here to user. So it’s digital data, dot user, dot profile, dot profile ID. So then we just put that in there. Again no default, force to lowercase, and clean text, and none. And you could say that this may be an option where you don’t want to force to lowercase if the value is alphanumeric and it had upper and lower in that value.
We’ll go ahead and save that one.
Let’s do just one more and here I want to show you inside the website as we look for things on the website, we may use the search function. And let’s say we’re looking for information in Paris.
Once we hit enter in this fictitious website it doesn’t really show any results, but if we look up here in the URL for this search results page, we see here that we typed in Paris. And the query string parameter is an S. So we can use Launch to say look for the query string parameter of S and grab the value and put it in a variable. So let’s go ahead and add this last one here. We’re going to call this internal search term.
And this time our element type is going to be query string parameter. And the value it’s looking for is that S. And we could say we want it case sensitive but we just want to leave it as it is. No default value, and here’s a case when people are typing in and some people type Paris all uppercase or upper and lowercase, there just could be lots of variety there so we want to clean that up. And again, duration of none. And we’ll go ahead and save this one.
Now we could do this all day long and we could create lots of different data elements and there’s different ways to grab it. But this is just a simple little introduction of some of the data elements that you would want to create. -