Make Analytics Better with Tag Management and a Data Layer

There’s something new in the world of tracking: the container tag. It’s more commonly known as Tag Management. You may have heard of it over the last year or so.

Very quickly this technology has spawned a number of companies and investment in this area. Some of the more well known tag management tools are (in no specific order):

[NOTE: I've been updating this list as more and more tag management tools become available.]

The rapid growth is validation that the simple act of tagging a site is complicated, and to do good measurement businesses need a faster, quicker and easier way to implement different types of tracking.

What is a Container Tag?

A container tag is simply a tag. It’s a line of JavaScript that you add to the pages of your site. But the special thing about the container is that it can hold other tags. Hence the name ‘container’.

In most cases you populate the content of the container tag using some type of web interface. Then the tag management vendor pushes out the content via their network (or CDN).

How Tag Management Tools Work

Tag Management tools add a "container" to your pages. You can then populate that container with various tags.

The beauty is that you remove the need for coding changes when you want to modify your analytics tags. Less work for the IT department!

The downside is that you can bypass some of the QA process that IT uses to insure the performance and safety of the website (or app).

But that’s the tradeoff.

Every business needs to evaluate the risk and rewards and decided if they should use a tag management solution.

I personally like container tags as long as they’re used carefully.

Rules: Making Tag Management Awesome

In my opinion, the really cool thing about tag managers is their ability to control which tracking code appears on a page. Most tag managers have some type of rules engine that can change the output based on the URL of the page or some other attribute.

For example, you could create a rule that insures your AdWords conversion tag only appears on your receipt page by specifying the container only show the AdWords tracking code when the URL of the page matches the URL of your receipt page.

Or you could customize the Google Analytics tracking code by including a custom variable based on a page attribute.

Dynamically Collecting Data with a Container

But wait, there’s more!

Many container tags can pull data from the HTML of a page and put it into your tracking tag. For example, some tag management tools have templates where you tell the container tag the name of an HTML element, like a DIV or anchor tag, and the container copies the data out of the element and puts it into the analytics tag.

This is especially handy when you’re coding Google Analytics events, custom variables or the ecommerce tracking code.

Extract data from the page HTML with a container tag.

Many tag management tools let you extract data from the page HTML and pull it into the container tag.

I know what you’re thinking. “That’s pretty cool. It makes it REALLY easy to configure complex tagging situations.”

I agree, very cool!

But there’s a problem. What happens if the HTML of the page changes? What happens if your site gets redesigned?

You’ll need to tweak your container tag to make sure that it pulls the right data.

I know what you’re thinking again. “What a pain in the butt.” Agreed.

The Data Layer

There is a technique that can help you avoid ever changing your container tag. It’s called a data layer.

Simply put, a data layer is a JavaScript variable or object that holds all the information you want to collect in some other tool, like a web analytics tool. You add the data layer to every page on your site and then have the container pull data from the data layer.

Use a data layer to store page data on every site page.

Use a data layer to store the data you want to collect in your analytics tags.

This insulates the data collection tools by separating the data from the page structure. No matter what happens to the structure of the HTML page the data layer will always be the same.

That means your container tag will always have a consistent, unchanging source of data to pull from.

Ideas for Data Layer Content

So what should go into a data layer? There’s a lot you can stuff into one. Here are just a few ideas.

Page Attributes: Data about the pages that people look at.

  • Page title
  • Page URL
  • Page category, sub category, etc.
  • Page version

Visitor Information: Anonymous data about the visitor. This works best for websites that can maintain state or have a logged in experience. All of this data provides many opportunities for segmentation in your analytics tool.

  • Visitor type
  • Visitor state
  • Visitor value
  • First conversion date
  • First conversion traffic source
  • Historical information about key actions (did they leave a comment, etc.)
  • Anonymous demographic data
  • Social information (are they a follower, etc.)

Data for conversion pages: Conversion pages are slightly different. They need to include details about the transaction or the value of the conversion.

  • Value of the conversion
  • Product SKUs
  • Product names
  • Product categories
  • Transaction ID
  • Total purchase value
  • Taxes
  • Shipping cost
  • Shipping method
  • Currency
  • Payment type
  • Month & year of transaction
  • Discount or promotion used

Your task is to convince your IT department to add a data layer to your pages. It may be a little work up front, but over time it will save them work.

And you don’t need to use all of the data on every page. It depends on what you want to track in your tool. But it’s better to have the data there and choose NOT to use it, rather than have to ask IT to add the data.

In reality you don’t need a container tag to implement a data layer. You can write your own custom JavaScript that translates data from a data layer and puts it into your analytics tag. But the container tag launched the need for the data layer.

Here’s a simple data layer example that might appear on a receipt page.


var dataLayer = {
"pageTitle" : "Receipt Page",
"pageURL" : "/pages/checkout/receipt",
"pageCat" : "Checkout Pages",
"PageCat2" : "",
"tranID" : "17658726382",
"tranTotal" : "34.95",
"tranTax" : "0.00",
"tranShipping" : "0.00",
"tranShippingMethod" : "USPS",
"tranCurrency" : "USD",
"tranProds" : "249|398",
"tranSKUs" : "249-32|398-12",
"tranProdNames" : "Kids Onsie|Kids Lava Lamp",
"tranCategories" : "Kids|Kids",
"tranPayMethod" : "VISA",
"visitorType" : "RETURN",
"visitorState" : "Logged In",
"visitorFirstPurchDate" : "20111205",
"visitorFirstProds" : "822"
}

Don’t Forget Mobile!

So now that we’ve got all the basics covered, don’t forget about mobile web and apps. There are a number of vendors that are doing some cool things with container tags and apps. And you can port the data layer to your mobile website or mobile app. It simplifies the data collection no matter what the platform.

As we move forward with an increasingly diverse number of content consumption devices, it will be important for businesses to publish first-party data in a way that’s easy to collect via tag management systems.

Be Sociable, Share!

    Like this post? Sign up to get posts delivered to your inbox.

    Comments

    1. says

      Justin,

      Great stuff here…seems everyone is writing a blog about TMS systems lately. I noticed you left out BrightTag completely in your post. Any reason why? They have a really nice data layer that you should see.

      -Rudi

    2. says

      Wow! You just gave me THE idea I was looking for to solve a problem.
      You can use this to tell the external software vendor the data layer you are going to be needing. And then through the tag container you can configure what tagging is going to take place where…

      Very Cool!

    3. says

      Justin,

      I met with an Australian company named Datalicious recently, who have a product called SuperTag. They’ve deployed their container tag to some major websites in the Australian market with great success. I can see an upcoming series of posts on each container tag and a summary post outlining the good, bad and ugly to help people make the right choice!

      Al.

    4. says

      More than the hype around tag management systems, what I like is the open talk that’s beginning about data layer. That’s an approach we’ve recently invested in at my company and I’m still wondering why this is still not widely known by people in our industry (maybe because it’s easier to implement vendors tags and “feed” them…?). And I would say that if you do the job seriously from a JavaScript perspective, you can even remove the need for tag management systems (which in my humble opinion is just another way to get tied up to another vendor) as your data layer can feed several analytics solutions and tracking pixels for remarketing. And voilà ;)

      • says

        Thanks Gautier for the insightful comment. I think most people take a very narrow view of data collection. They simply slap the tags on the site and are done. Even the more advanced people only think about the one or two pieces of data that they need for their analytics tool. They don’t think about a framework of data that they can use to seed the analytics tags. I agree, tag management is not technically needed. But it can really help. ANd many tag management tools offer additional features that can be very useful.

    5. says

      An interesting group is trying to make tag management as a “self-hosted” option. Qubit’s “Open Tag” is designed to be served by your own server, or you can pay them to serve and manage for you. This solution is not as turnkey as the other folks you mention… but by taking on serving costs yourself, you may find that this solution saves money, especially for large sites.

      • says

        @Michael: Thanks for the comment and information about Open Tag. I think you hit the key point that self-hosting gives companies another option. If you need to self-host use Open Tag. If you need something more turn-key go with another provider.

    6. says

      Great post, Justin! Is there a risk that the data layer could actually put you back in the same boat of why a TMS was needed in the first place? A case of, “Well, shoot, we need some additional data, so we need to go update our site to get that captured and added to the data layer.” I suppose (I think) that you could leverage the TMS as a near-term fix in these situations so you’d be collecting the data using whatever logic needs to be in place to figure out that data based on URL/content, and then queue up a list of items to be migrated to the data layer in the next quarterly release cycle for the site. Does that make sense, or am I misunderstanding the approach entirely?

      • says

        @Tim: I think we’re on the same page. You still need to make some type of technical change if you want to collect more data. I think my main idea is that by adding any first-party data to a data layer you separate the data you want to collect from the site presentation. You don’t need a TMS to suck that data into an analytics tool. You could do some custom JS coding to pull it in. But using a TMS makes that process easier.

        Thanks for the comment.

    7. Will says

      Hi guys,
      really interesting post – i’m not 100% sure about this, but I think using Container Tags to handle Google Analytics tracking means that GA no longer offer any kind of customer support if you have any issues with the GA tracking, due to it not being exactly how they recommend you implement. This is possibly a potentially huge disadvantage? (as i said, not 100% sure about this, so would be useful if someone could confirm!)

      • says

        @Will: Technically Google doesn’t offer any support for Google Analytics. There are the forums, which many of is on the team do use. But you can’t pick up the phone, or call, the Google Analytics team for support. Unless you use our premium product, then you do get support.

        So using a TMS will not change how Google supports users.

    8. Antoine says

      Hi Justin,
      I like the last lines on Mobile, especially on Apps where you also avoid the submission to App store and Google Play for Tag modification (of course still need to go through to update new version for non tag related reasons)

    9. says

      Hi all,

      Pleased to see so much comments. Few comments about the posts i just read:

      @ Michael and Justin, self hosting is handled by other players of the Tag Management Market. At least, Tag Commander is offering it but you’re right : hosting through a CDN or self hosting is one of the segmentation of the market.

      @ Gautier, of course i could answer that it’s better to be tied up with one vendor than tied up with all the vendors used :-). More seriously, tag management has been generally created by people with a huge experience in analytics motivated by the pleasure of helping their previous clients to leverage their data and really jump into the analytics world. You can’t imagine how frustrating it is to see a client using one of the best web analytics platform and still fighting to get a smart use of it. I think that this impression will be commonly shared among people coming from the webanalytics world and i could among the online consulting world. This comment is just to explained that our pleasure in life is not to tied up our clients :-). Then i’m a little skeptical about a situation where each commerce company would create its own solution. Daily discussion we’ve with them show that they have so much things to do that it couldn’t be prioritize. The value we bring is just to deliver the benefits without the workload to built it.

      Thanks again for your post Justin !

      Michael

      @

    10. says

      @Michael, your point is valid that tag management is here to help. But to me, if clients are already overwhelmed before considering a better WA implementation (i.e, an implementation that is not only tied to one tool), it’s my turn to be skeptical about what an additional tool might bring in terms of complexity: people will think they can indeed be IT-free; which to be honest isn’t true… And I’m not even talking here about the cost of tag management (hard-cost, soft-cost) that most people won’t be able to afford (let’s face the reality: most businesses use Google Analytics => http://goo.gl/AJS9i. IMHO, because it’s free).

    11. says

      Great to see this excellent illuminating post and the insightful comments it has generated. Here at TagMan http://www.tagman.com we recognize the positives and negatives of both dynamic data collection approach and the dedicated data ‘layer’ approach as you describe it Justin. As we see it, there are 2 further downsides to the dynamic approach, besides the functional dependency as this post describes (e.g. if the page structure changes, your data collection will be compromised):
      A) There is also a temporal dependency created, in that the page has to first be loaded before the data items can be identified and captured. This can inhibit the full firing of tags at the top of the page (because the tag can’t properly fire until the data it needs is ready to be included in the tag call), which the asynchronous TagMan container allows for and which we encourage as it optimizes page load times and data collection rates.
      B) Another soft issue is that the more work the TMS is doing in the page (e.g. crawling the page, identifying page elements, pulling in the data values), the more TMS code and processing is going on as the page loads, which cannot be helpful to the speed of the core page load processes.
      Our product, TagMan offers both methods for data collection.

      We generally recommend 1) creating a robust foundation data layer, setting the key values at the top of page as the container and tags load, which can be 2) supplemented by our dynamic parameter functionality for adding further data items on a tactical basis without having to touch the data layer (but we’d suggest move those dynamic parameters into the data layer when a suitable opportunity arises to do so).

    12. says

      @Gautier, i fully agree with you about this strange idea that once you’re using a TMS, you don’t need support from your IT. You will need support from your IT but once a year in order (as Justin said in his post) to update eventually the data layer . So instead of asking help frequently, you’ll be able to be autonomous during 11months of the year and ask them for help during one month to get few variables more (depending on your measurement strategy). Si i’d rather adopt the idea that TMS are a tool that will help to the interface between technical and business team and as a consequence help online teams to be more performant.
      Nevertheless, if you also accept the idea that iterative marketing is the right approach, you should agree that it’s difficult for a business team to always have to explain/justify why they want to measure that or this. Sometimes, in this new internet field that we ‘re discovering everyday, you need to be able to experiment things. TMS offers business teams the right to experiment without asking for resources. It makes a lot of differences and be sure that it helps creativity to jump on board.
      One of they value is the ability to define activation rules that will be able to fire tags following the “3R” rules (right situation, right time, right visitor). Based on the data layer you will be able to mix data input to activate the right tag and it often makes the difference in terms of acquisition cost and profitability of online campaigns.

      Best
      Michael Froment

    13. says

      Hi Justin, all, and special props to my French colleagues ;-)

      Great post and yes, TMSs are definitely a hot topic these days!

      the thing with TMSs is that no matter how you look at their inner workings, if your web pages do not generate the right information that’s supposed to be passed in some shape or form to the analytics solution, you fail.
      There is a limit to the number of data rules you can setup to capture/generate tags on the fly so imagine how many more rules you’d have to set up to handle corrections ;-)

      Of course i’m not partial since I provide a tagging quality assurance solution (Hub’Scan) that integrates seamlessly with TMSs and works as the safety net by linking actual captured tag values with tagging plans.

      Cheers,

      Julien

    14. Naveen says

      Justin,

      Few questions

      1. What are your thoughts about Adobe Tag Manager – as compared to standalone TMS vendors?
      2. How easy is it to switch from one TMS to another? One of my colleagues at work – read that if use one TMS then it is fairly expensive resource and time process to move to another vendor.

      Thanks

      -Naveen

      • says

        @Naveen: Sorry for the delay in getting back to you.

        1. I have not used Adobe’s tag manager, so I can not comment on it.
        2. I agree, switching TMS vendors can be expensive. Most of the work is spent recreating the business rules in the system.

    15. says

      Hi all,

      @ Angus Glower Wilson, at Tag Commander we also offer both methods. The first one can be the only way to get a data in a very short delay but it is not adapted to the current lack of normalization that still exists on a website and jquery is not always a reliable way of solving the problem. So we strictly recommend to our clients to build their data collection strategy based on a strong data layer. Let’s all keep in mind that TMS creates values because they also makes data collected more reliable and useful for the web analysts. Many web analysts i met in my previous life used to spend so much time at understanding discrepancies between datas ! As professionals of Tag management, we need to insist on the fact that good data collected means good data layer and as Gautier said it, support from the IT is key !

    16. dg says

      I’m on a website that deals in distributing information and not in taking any money in. I have a hard time seeing what use a tag management system is? I’m using notepad to place a javascript include on my website files. One by one. Is the tag management system essentially doing that same process? how does it get the files changes to the server? via FTP? or does it need to be a component installed on the server that has local write access?

      I am sure it works well, I am just not seeing how it functions. Something that finds an untagged page for me might be useful.

      • says

        @dg: Tag management systems are cloud based with a UI. First you place a line of JavaScript on your site. Then you log into the system, put your tag code into the UI. The tag management system will them push the JavaScript to the appropriate pages.

        You never need to log into a server.
        No swapping text files.

        If you ever need to change your analytics implementation, or add new tags, it’s a HUGE timesaver.

        That’s a HUGE oversimplification, but you get the idea.

    17. says

      @Nitesh – we have transparent pricing at OpenTag – http://www.opentag.qubitproducts.com/pricing/, your first 1m pageviews are free and then it’s $99 for every 10m pageviews per month. We believe that every website should have tag management that doesnt cost the earth as it’s really just a CDN at the end of the day. At QuBit we offer an enterprise class solution that’s self service with no long term contract required.

      @Justin We also believe in open standards around the data layer and have been working with other companies within the space to adopt an open standard approach to the data layer, and are starting to really gain traction, we open sourced the standard:
      https://github.com/QubitProducts/UniversalVariable

      Graham (QuBit CEO)

    18. Chris says

      Hi

      This may be a very naive question but I am not a programmer and TMS almost sounds too nice.

      My question is: With TMS, is it possible to track eg.
      - downloads of pdf (files in generel)
      - Clicks on a Play Video
      - Time a video is being watched
      - A Form Submit (with no URL-unique thank you page)
      - Google Analytics eCommerce tracking (If YES, any example on how to?)

      I am very excited to hear from some very helpful TMS Guro :-)

      Regards,

      Chris

      • says

        @Chris: It depends. Even with a TMS you still need to do some setup to track the items you list. But when you use a TMS the setup should be a lot easier than adding code directly to your site.

    19. Naz says

      Thanks for the great article.
      Which of these tools provide direct reporting? I’d like to be able to go to ad network X and say, “our tool shows 50 conversions as opposed to your 60″ etc.

      • says

        @Naz: Most of the tag management tools don’t provide a lot of reporting. I know that TagMan has some. Not sure about the others. But the bigger picture is that a container tag is a vehicle to put measurement tools on your site. So you would use a tag management tool to make the Google Analytics, Adobe or WebTrends installation easier.

    20. says

      @Naz – TagMan does indeed offer campaign and conversion tracking/reporting on top of fundamental optimized tag management functionality – we offer logic to link the campaign/conversion activity to the tags, allowing you to control what tags fire and when, to ultimately control what data gets passed appropriately to your marketing vendors.

    21. says

      @ Graham : I’m not sure transparency implies only to communicate on pricing. Some companies are almost giving TMS but because they use it to attract consumers to other products and services sold with a much more expensive pricing. Independant and trustworthy TMS vendors offer also the guarantee that no other use of data will be done.

      In the Era of Big Data, you can’t ignore that free solutions can sometimes offer bad surprise. Google Analytics is a kind of standards, it’s free but the way Google is said to use the data of your visitors browsing your website to make money is not a so transparent process. Our clients generally prefer to pay the price and control their data. Google Analytics in Norway is the signal that markets and people are opening eyes on business model that will be soon perceived as “dirty business models”.

      Also regarding your universal list of variables, it’s valuable to organize things but i don’t understand how you can position Qubit as an enterprise class TMS when dealing with a so simple list of variables. I think that the market should now consider that there are different segments on the market and specific solutions addressing each market but “enterprise class TMS” are really different from what you describe, at least regarding the data layer mentionned by Justin

      • says

        @Michael: I find this comment laughable. To imply that Google is giving away Google Analytics for free so Google can collect data and use it is something people worried about in 2005. That myth has been thoroughly debunked. Google does not use analytics data for anything. Each company owns their own data. Google does not have access to it. In fact, it’s globally distributed so no one can even get a copy.

        While I can’t speak for all vendors, Google has taken many, many steps to meet global security and privacy guidelines. Google Analytics fully complies with Norwegian and European data protection laws. All of them. Period.

        To be honest, it’s comments like this that really make me mad. You’re spreading fear, uncertainty and doubt rather than adding constructive, honest information.

    22. says

      Took a while to get my mind around this but now I get it. In WordPress “tags” are referred to as “widgets shortcodes”. The main difference is that the tags load “widgets” from remote sites, sort of like remote ajax calls. Some fancy javascript there for sure.

      Glad to have found this post.

    23. says

      With the Google Tag Manager announced, you might want to add that to the list, Justin ;-)

      One thing that would really interest me about the Google Tag Manager: Will it also offer deduplication features for an improved ROI attribution? I would have mixed feelings about Google providing this, because there are obvious conflicts of interests.

    24. says

      Some great points made there Justin – a little late to the part with this comment but you should also have a look at DC Storm’s Container Tag. We’re using Storm Container Tag to collect data in a lot of interesting ways, including, as @Chris mentioned, tracking pdf downloads and feeing the details into Google Analytics ecommerce tracking tags.

    25. says

      Hi Justin,

      I love the Google Tag Manager, however, I am noticing one big difference between our currently coded GA ecommerce tracking and the new datalayer way of GTM. Currently we would loop through each item in the cart and create a new _gaq.push for each item, name, price, color, quantity. How does this work for the datalayer in the new GTM to ensure e-commerce in GA captures the pricing and item level detail?

    26. says

      Krux Apps also includes a free tag management tool that is also called SuperTag but it is not the one you have included in the links above. I manage analytics and ad tags using this tool and have the option to deliver tags to specific pages, a specific div on the page for visible tags, and configure tags to load right away or after the content loads. http://www.krux.com/apps/why/supertag

      They also offer an enterprise data management platform (DMP) that includes a more advanced version of SuperTag, but that isn’t free.

    Trackbacks

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>