Using a data layer for Analytics and other Experience Cloud solutions is a best practice. In this video, learn how to pull values out of the data layer and use them in Experience Platform Tags to populate variables in Adobe Analytics.
Review additional information about data layers in the Experience Cloud documentation.
Define or identify a data layer standard to use on your site.
Populate the data in the data layer.
In Experience Platform Tags, create “data elements” that map the data points in the data layer. These data elements are used throughout Experience Platform Tags in rules and extensions.
In either the Analytics extension’s global variables section or in a Tags rule, assign the values in data elements to props, eVars, pageName, and other Analytics variables.
Trigger a beacon that sends the data into Analytics.
The following video walks you through the process.
And put it in there.
Okay, Save to Library and Build, and that’s done and that’s great, but that’s not going into my beacon yet and so now I need to decide how I’m going to take the data out of these data elements, the Page Name and Site Section data elements and push them into the beacon and there’s really two ways, one way would be in a Rules so I could go in and I could create a rule that assigns them to different props or eVars or Page Name and Channel and those kinds of things, or in this case what I’m gonna do is go back into Extensions, and go into Adobe Analytics, Configuration, and I’m gonna scroll down here to the Global Variables, now the reason why I’m gonna do this here, is because they are on every page, and there’s really no exceptions I’m going to set a Page Name and I’m going to set a section on every page, so if you’re gonna do it on every page, if it’s really gonna be global like that, then you can set it in the global variables otherwise you’re gonna want to go set it in a rule so that you can have more control over when you actually set that variable. In this case I will scroll down to the Page Name and instead of typing something in there, I can actually click on this icon and select the Page Name data element, Select. Super easy, and the Channel variable, I can do the same thing, for the Site Section data element. Done, except for the fact that it’s pretty good practice to go ahead and set the Page Name into an eVar, so I’m going to do that as well, and I happen to know that we have eVar four set up for this purpose, so I will set that as well, and we’ll set that to the Page Name as well. And it’s really just that easy, so we’ve actually taken the value out of the Data Layer, we’ve gone into Launch and we’ve created these data elements to store that data, and then in this case we’ve used the global variables to put them into Page Name and Channel and eVar4. So now let’s Save that to the Library and Build.
And now we should be able to go back to our page, and, get rid of the console there maybe, and let’s go ahead and refresh.
And there’s our hit, and fingers crossed now we have Page Name, we have that same Page Name in eVar4, and we have our Channel, also know as a Site Section, our company info pages, etc. So that is how you can actually use the Data Layer to get not only the Page Name and Channel but really any variables set and pushed in the beacon to Adobe Analytics. Thanks and good luck!
The specific data layer used in this video may not be considered “best practice” for your organization. The concept of using a data layer for surfacing important data to your digital marketing solutions is best practice.