Why a data layer is a good thing

Back in the old days, when we used the traditional division between an s_code and on-page code, the concept of a data layer made little sense. The developers had to add some code server-side to generate the on-page code. Gathering the information to be captured was a server-side issue: the CMS would have to collect the information from one or various sources (CMS DB, CRM…) and present it on-page, so that, when calling s.t(), the s object would have all needed information.

However, now that tag managers are becoming the norm, the previous approach does not work well. There is no on-page code; all code is generated in the tag manager and injected to the page through it. This means that, in order to track some data, it must already be in the HTML code or in other resources available to JavaScript, like query string parameters or cookies.

One might think that, as long as the required information is visible on the page can be extracted using CSS selectors, we are safe. Consider the requirement to capture the city in the delivery address and this code:

Using the selector #delivery-address .city, we should be able to extract “London”. But, what if the developers decide to change the id or the class? What if there is a new requirement to completely remove this data from the web page? Our tracking will be broken and, if this happens a few months after the release, we will probably not know why.

The most reliable solution is to add a JavaScript object, completely independent of the rest of the HTML code, with all the relevant information of the web page. Then, the tag manager just needs to reference directly the elements in the JavaScript object. The developers can then change anything in the HTML code and, as long as this JavaScript object is kept intact, the tracking will continue working.

DataLayer_Blog_Example-2

There are many ways to create a data layer, but all fall into two categories: create a custom data layer or follow a standard. I will never recommend to create a custom data layer. There are a few standards that are worth mentioning:

  • AEM client context. This is the de facto standard that comes with AEM. I have spoken with AEM developers and all say that this can be used in many cases.
  • JSON-LD. I have never worked with this one, but one of my clients was already using it. More information here: json-ld.org.
  • W3C Customer Experience Digital Data Layer. I always recommend this standard, as it has been produced by the W3C (the same body standardising the Web) and Adobe took a role in this standardisation, together with other companies like Google, IBM, Red Hat… The previous image is an example of how the data layer would look like in this case. The standard itself is freely available: http://www.w3.org/2013/12/ceddl-201312.pdf.

In future posts, I will add some details about the last standard.

A brief introduction to AAM

The concept of a DMP (Data Management Platform) is not new in the digital marketing arena. However, there are still many marketers who do not know of this type of platform and what it can do for them. I will explain what is a DMP and what is Adobe Audience Manager.

In today’s digital life, visitors give a lot of information about their traits. However, that information tends to be siloed. The two main sources of information, CRMs and web analytics, do not “talk” to each other. Your web analytics tool just gives information about on-line visitors and your CRMs only knows about static data. Ideally, we would like to have all that information combined in real time so that we could provide the visitor with the best experience.

Think about these scenarios:

  • An airline wants to offer credit cards to frequent fliers between London and Paris.
  • A retailer would like to retarget visitors to their website, who have just moved to a different website without purchasing.
  • A media company is interested in selling ads on their own websites and wants to show mainly relevant ads.
  • A car manufacturer has created a series of ads, which should be shown in sequence.

All these scenarios and many more can be fulfilled with a DMP. Without getting into much detail, a DMP uniquely identifies a visitor and tries to get as much information from that visitor, using different sources and marrying the data from each of the sources. One other key property of a DMP is that it should be completely anonymous; in other words, no Personal Identifiable Information (PII) should be managed by the DMP.

Demdex was one of the companies that offered a DMP. Adobe acquired Demdex a few years ago and included the DMP in the Adobe Marketing Cloud. This product is now known as Adobe Audience Manager (AAM). What are some of the differentiating features of AAM?

  • It integrates nicely in the Adobe Marketing Cloud.
  • It can be natively be delivered through DTM.
  • It supports Adobe’s Visitor API. As a consequence, you can use the Master Marketing Profile (MMP) in AAM.
  • It captures natively all Adobe Analytics variables (eVars, props, events…)
  • It can be used in conjunction with Adobe Target to create personalised experiences.

I have been working with AAM now for a while and I can see a lot of potential in it.

DTM permissions and workflow

Some time ago, I received an urgent call from a customer that claimed that DTM broke their website. They wanted to see me immediately, as that was causing a huge impact in them. Fortunately, the problems only manifested in staging, but they could not move to production. Once I arrived at my client’s office, I immediately realised what had happened: the data analyst had created some data elements using JavaScript he found on the Internet and he just copied and pasted the code. The code worked on his computer, so he went to approve and publish it. The reality was that his code only worked in IE and crashed in other browsers.

As I have already explained, there are many benefits from using a tag management solution. However, with great power, comes great responsibility. Using DTM does not mean that marketers can implement anything they want and publish rules as they like. To the contrary, they must be very strict. The previous example is exactly the opposite of what must be done.

The solution I suggested to my client is to follow a very strict workflow and use wisely the permissions:

  • Anybody who needs to create new rules should be given the User role. This allows the user to create new rules and make sure they work fine using the right DTM plugin.
  • You need to have a group of testers that have the Approver role. They are responsible of making sure the new rules not only work fine in one browser, but they are cross-browser compatible, do not break the website, capture the expected data…
  • Once the rules have been approved, it is time to publish them. Very few people should have the Publisher role and publishing rules should be done very carefully, just like a typical code release.

Workflow

Some additional recommendations:

  • Publish rules at a certain time every week, so that, in case something goes wrong, it is easy to identify that the new rules are the culprit and roll back to the previous approved version.
  • Get some developer’s time in order to create JavaScript rules. He will probably need 5 minutes per rule and will do it right the first time.
  • The testers, ideally, should be the same as the website testers, so that the tests are full tests, with the right tools and environment.

Custom conditions in DTM

When creating both page load rules and event based rules in DTM, you have the option of configuring some conditions to determine when to fire those rules: parts of the URL, cookies, browser properties, JavaScript variables… If you add more than one condition, the AND boolean operator is applied to all conditions. However, in some cases, these out-of-the-box conditions are not enough. Thankfully, DTM offers the custom condition, where you can write pure JavaScript.

The first thing to note is that the snippet of code must return a boolean. It might work with expressions that can be evaluated as true/false (like empty/non-empty string, 0 or different than 0), but I have just not tried them. In other words, there must be a return statement within the code. In fact, the return statement must be at the very end of the code.

This code will NOT work:

condition_not

What I always do in this situation, is create a variable named ret and return it at the very end.

condition_yes

Execute JavaScript in event based rules

If you create an event based rule that is fired upon click of a link and you want to execute some JavaScript, chances are that, if you add it to the “JavaScript/Third Party Tags”, it will never be executed. The reason is that the browser has already been instructed to unload the page and move to a new URL. It will not have time to load an external JavaScript and executed; if fact, I think that it will not even attempt to do it.

What can you do in this case? Use the custom condition of the rule, to make sure the JavaScript is executed. For example, to write a cookie:

custom_js

There is no need to return true in this case. However, it is more convenient to leave it as shown, as the console will then show the rule as executed.

Capture information from the clicked element

Imagine you have an event based rule in which you want to capture the full URL of the clicked linked and store it in prop1. Your first idea would be to create a data element that returns this.href:

de_this

However, one limitation of data elements is that they have no idea of what DOM element has been clicked, if any. If you try to use the this keyword in data elements, you will get a surprise: it will not work as expected.

One possible solution is to go to the custom code of the Analytics section as set the value there:

custom_code_this

Remember to include s.linkTrackVars if you are making an s.tl() call.

I do not like the previous approach, as it is not elegant and you need to explicitly open the editor to see the contents of the rule. My preferred solution is to use the custom condition and set a data element on the fly; then, in the analytics section, just reference the data element as usual:

custom_setvar

prop_de

 

Do you have any other uses for the custom conditions in DTM? I would love to hear your opinions on that.

How to organize a web analytics team

A few months ago, I was working with a customer on premise and the manager asked me a tricky question: how to organise the analytics team. That company was undergoing significant changes in the analytics front, as a few key members of this team were leaving. As with most questions in life, there is not a clear and definitive answer to this particular one. However, I can share what I have been seeing in my customers.

When companies are small, they inevitably go for cheap or free web analytics solutions. In fact, this is a no-brainer, given the cost of the licenses of proprietary solutions. In these companies, there is only one person in charge of the task of analysing visitor’s behaviour and, usually, this is only one of the many tasks he has to do. As the importance of web analytics grows, this person ends up working full time on web analytics. Sometimes, a second person joins this mini-team, but within a broader team that manages all internal analytics and reporting.

The next breakpoint happens when the company as a whole realises the benefits of having a very good understanding of the customer behaviour. In this situation, more and more people want to have access to the statistics gathered by the analytics tool. Not just only the web analysts, but others in the marketing department (or even other departments) want to have first hand data. These other roles do not need full access nor are going to spend their full working day on the web analytics tool, but they want to be able to self serve. As a consequence, more people demand more features and capabilities.

Inevitably, this approach leads to larger analytics teams, with a manager and a team of two or three people that are working full time on all aspects of the analytics: reporting, ad-hoc analysis, implementation, supporting other users… But not only that, another consequence is that free solutions become a problem rather than a solution and more powerful tools are needed, like Adobe Analytics. As an example, I remember one company switching to Adobe Analytics just because their previous solution did not scale well.

The last big change comes when the websites and apps are in continuous development, constantly adding new features, with releases every few weeks. It becomes impossible to keep up with the changes in the development and, at the same time, satisfy the reporting needs. At this point, there is a need to split the web analytics team in two: one dedicated exclusively on the implementation and another on the reporting. These two teams have different line managers, although they are closely connected.

Even in this situation, there is still room for improvement, especially in big corporations. You can see further separations in both teams for apps/web, different websites, desktop/mobile web…

In parallel to all of this process, there is another tip I would like to share. The web analytics job market is fairly small, but very dynamic. There are very few good web analysts and recruiters are always luring web analysts to fill vacancies in other companies. It is therefore very important to have a healthy balance between junior and senior analysts. Both are needed and junior team members need to receive a good training to be able to fill in the gap when more senior members or even the manager, eventually leave the company.

As I said, this is only my experience, but after having worked with dozens of companies, where this pattern tends to repeat, I am inclined to believe that this is the best approach as of today.

Quick tip: track sprint reference

After publishing my previous post, where I recommended tracking the s_code version, I realised it could have been enhanced with a new type of version to track. Another version number that is even more useful is the sprint reference or whichever value you use to track each of the releases of the website. This idea came from one of my customers (thanks Glenn), who is under the process of redeveloping the whole website and analytics implementation. If you either have a development team that is continously adding new features to the web or are in profoundly redeveloping the website, you want to know the ROI of this invesment.

Copying the sprint reference into an eVar, you can create reports that show the revenue or any other important conversion metric for each of the releases. Of course, this will require an extended period of time in the report and equal periods for each release and not all periods are the same. However, with this data, you can show the increment in revenue derived from the new release.

Quick tip: track code version

One of the suggestions I usually did when I worked with a new client was to track the s_code version. Now that we are moving to DTM, we do not have any more the concept of the s_code, but we have the concept of publishing new rules, which is similar to an s_code version. The idea is to keep a value in a prop, which is changed every time a new s_code is pushed live or a new set of rules is published. My typical suggestion is to add both a date and a version to the string.

This is a typical report looks like:

scodeversions

It is very clear when the different versions of the s_code went live. But not only that, it can be seen that, after the release of a new version, it takes a couple of days to propagate. For example, on 21st January, two versions are still reported by browsers.

There is not much business value from this report and I cannot imagine any web analyst pulling a report with this dimension. However, the idea behind this data is to be able to easily track errors that are introduced with each release. Think about these two complementary scenarios:

  • An new error is reported in the analytics code. Checking when this error occurred first, it is noticed that it the date matches when a new s_code/DTM version were published. As a consequence, you can initially concentrate on the changes introduced with the latest release.
  • The previous error is fixed and published. However, there is still a small number of cases where this error is occurring. By checking the visits for each version of the code, you can see whether some users are still using the old/buggy version of the code. As these users update their caches, you can see that the incidence of the problem is fading away.

Use a tag manager

Back in the old days, the only way to add Web analytics code to a website, was through manual coding. If you were using Adobe Analytics, you would need to add two pieces of code into the website: the s_code and the on-page code. The s_code is a JavaScript file with common code for Adobe Analytics (SiteCatalyst) and the on-page code contains the page-specific data. I am sure many of you are familiar with these lines of code:

While this does not seem to be a great problem, my experience with many customers shows that this traditional solution is far from ideal. Typical issues that I have found are:

  • Web developers have usually little or no knowledge of Adobe Analytics code. The moment you mention “eVar” or “prop”, they completely disconnect from the conversation until they clearly understand what these words mean. Do not get me wrong, I have been a developer myself, I have nothing against developers, but I know that it is very difficult to find a web developer that understands Adobe Analytics.
  • Changes take a very long time to be published. Even the minimum code change (just adding an eVar, for example), can take weeks, if not months, before it is live. The main reason is that, any new feature must be added to a scrum backlog, a change request…
  • Disconnect between IT and marketing. These two departments tend to have very different goals. As a consequence, what is of great importance for a web analyst, might be considered low priority by the scrum master.

If you search for more reasons, you will find many more.

So, what is the solution? Use a tag management solution, like Adobe Dynamic Tag Management. This is not the silver bullet that will solve all your problems, but it will help move forward more easily. Do not even think on developing your own solution: it will take you years before you have a solution that matches the worst commercial solution.