Choose between Include and Exclude filters to segment a report in Google Analytics

Just like there’s a fine line between ‘friendzoned’ and ‘she likes me’, there’s a fine line between the ‘Exclude + contains’ and ‘Include + does not contain’ filters used to segment reports. Just like you believe she likes you but you’re actually friendzoned, you believe you’ve put the right filters and are receiving the right data, but you actually aren’t! Thank me later.

 

 

Let me present you with an example – Given a global e-commerce website, let’s say we wanna view a sessions report in Google Analytics, segmented in terms of location. The segment is supposed to display data excluding a particular country, say China. Which filter shall we use? Shall we go for ‘Exclude sessions that contain China’ or ‘Include sessions that do not contain China’?

Let’s say we use the latter, i.e., Include. We expect the output to be a segment that doesn’t contain data from China.

To test the decision we just made, let me introduce you to Marco, who is our user from Italy. Assume that Marco visits our website, thereby beginning a session. He spends some time exploring it (sending interaction hits), our website being the Italian version, of course. But this curious chap, decides to check out the Chinese version of our website. He switches his country from Italy to China using the location dropdown menu, spends time exploring our Chinese website, and exits, thereby concluding his session.

Does Marco’s session appear in our segment? His session contains Chinese data, and thus it must not appear in our report segment. But bro, it does.

A session comprises multiple hits. Each hit during a session undergoes the filters we’ve applied to our Google Analytics report, and the session seeps into our report if any of the hits match our conditions. Each hit of Marco’s session undergoes the filter Include if session does not contain China. And so, when his Italian hits undergo the filter, they match the condition and the session lands straight onto our report. His Chinese hits discard the session, but his Italian hits include the session into our segment.

And thus, to completely exclude Chinese sessions, we must’ve used the Exclude filter. Quite similarly and quite often, it gets a bit tricky to decide the right filter. Here are a few case studies to help you clarify the blurred picture!

Case Study I – View Order Confirmation data for all countries excluding Norway

So we wish to create a segment on Google Analytics, which shows order confirmation data for all countries except Norway. To achieve this, open any report on your Google Analytics dashboard and start creating a segment. To create a segment,

  1. Click on Add Segment > New Segment > Conditions (Under Advanced).
  2. Give a name to your segment and choose ‘sessions’ from the drop-down next to Filter and ‘Exclude’ from the next drop-down.

Since we only want to view the sessions of users who placed orders successfully, it’s a great idea to extract sessions that contain the page that comes immediately after the order has been placed, most popularly known as the Thank-you page.

So the conditions that we set while creating our segment look like this –

Page Contains – [pagepath of your thank-you page]

AND

Page does not contain – [pagepath specifying the country to be excluded]


Case Study II – 

Sometimes we wanna look at the behavior of our guests (visitors who don’t sign up/log in). To exclude the data of logged in users, we need to create a variable in Google Tag Manager and pass it to Google Analytics as a custom dimension. Let’s say we call our custom dimension ‘loggedinstatus’ which can have the values ‘logged in’ and ‘guest’ depending upon the status of our visitor.

To exclude the sessions of logged in visitors, start by creating a segment.

  1. Open an All Pages report in Google Analytics and click on ‘Add Segment’.
  2. Select New Segment and choose ‘Conditions’ under ‘Advanced’ from the left panel.
  3. Name your segment accordingly and choose Exclude from the dropdown.
  4. Start by entering the conditions. To exclude sessions of logged in users, our custom dimension, which we just named loggedinstatus, must contain the value ‘logged in’. Specify more conditions to view a more specific report, just like we retrieved successful order placement sessions for Case Study – I.
  5. Save your segment.

Summing it up, the confusion between Include and Exclude creeps in when a single session may be a combination of different versions of a website. In the examples above, one session was a combination of Italian and Chinese versions of our website, whereas in another, a user interacted as a guest and later logged in, thereby accessing both the versions. This makes it tricky to segment reports accurately, but now you know what to do!

How we can help

Very often, even the biggest of companies keep receiving inaccurate Analytics data, and they have no clue what’s wrong! Some companies don’t even realize they’re working with erroneous data. Retrieving accurate reports is a technical art. And that’s what we excel in. We are a crazy team of Google and Adobe Certified Analytics Experts who eat, breathe, sleep and dream Analytics. And we’ve made it our purpose and passion to electrify your business’s potential through Analytics.

Contact us here.

Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –


How to detect mobile device on Google Tag Manager, DTM & Tealium

Wwwhhhooaaaa this form looks perfect AF! Lemme check how it looks on mobile ???

Mobile responsiveness is a task, isn’t it? The most beautiful features on desktop, might sometimes appear disastrous on a mobile device. If a similar situation is ruining the mobile experience of your website, and you’re looking for a way to show certain features only to your desktop audience or vice versa, here’s how you can do it.

I’ll be helping you detect the device type of your visitors and use that data to serve different (and pleasant) experience on different devices (desktop and mobile).

Following is a detailed procedure on how you can achieve it using Google Tag Manager, but we will also talk about how you can do it on Dynamic Tag Manager by Adobe, and Tealium. Let’s get started!

Detecting a Mobile Device on Google Tag Manager

We’re going to divide the job into three parts.

I – Variable creation
II – Trigger creation
III – Application

I – Creating a variable

We’re creating a variable which returns the value true for a mobile device, and false otherwise. This variable is our device detector!

1 – On your GTM dashboard, go to Variables and click on New.

2 – Give a relevant name to your variable, and under the Variable Configuration, choose Custom JavaScript. I’ve named my variable as Device Check.

3 – Thanks to http://detectmobilebrowsers.com, which is an open source for mobile detection scripts in various programming languages, we can get a JavaScript snippet for our variable. Choose JavaScript and save the .txt file. Then just copy the entire code from the file and paste it as the custom JavaScript of your variable.

Alternatively, you can also just copy the script from here.

function () {
 var a = navigator.userAgent || navigator.vendor || window.opera;
 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) { return true; }
 return false;
 }

Paste the above code as the custom JavaScript of your variable and click Save. Our variable has been created!

II – Creating a Trigger

Now that we’ve detected the device type, this triggers our next action : Decide what our visitor gets to see! Based on the value returned by our variable, i.e., true for mobile and false for desktop, we’ll create a trigger.

1 – On your Google Tag Manager dashboard, go to Triggers and click New.

2 – Name your trigger and under Trigger Configuration, choose Custom Event.

3 – Since we want this trigger to fire at every page hit, under Event Name, type .* and check the checkbox to enable Use Regex Matching.

4 – Now is when our variable and trigger come together. From the two radio buttons, choose Some Custom, and apply condition to include or exclude a mobile device. To exclude a mobile device, we want to go ahead with devices that return false to our variable. This is what our condition must look like –

The above condition excludes mobile devices. If you want to exclude desktops/tablets, you can put the value true in the last field.

So now, we’re ready to finally achieve our goal of excluding/including mobile devices!

III – Application

The whole idea behind this article came from our own experience with a pop-up form that worked just fine on my laptop, but fucked up on mobile devices. We wanted to hide the form from our mobile audience, solved it and thought you might need the solution some time! And so the example application here, is a Mailchimp subscriber pop-up form that we added to our website by creating a tag on Google Tag Manager. Here’s the tag without any trigger exceptions –

We edited the Triggering settings of our Mailchimp tag, and of course employed the trigger we created in Step II. To add a trigger to your tag, click the Triggering tab and choose the trigger you created earlier for the task (Step II). That’s all!

DIY – Test our form on your desktop and mobile device! Open datavinci.com on private window of your browser.

So that’s how you can use Google Tag Manger to detect device types. Let’s see how you can achieve it on DTM (Adobe’s Dynamic Tag Manager)

Detecting a Mobile Device on Dynamic Tag Manager or Adobe Launch

On DTM or Launch, the process is much simpler. While creating any kind of rule, you get an inbuilt condition to select the device type. Just select the device for which you want to fire the tag from the drop down, as shown in the screenshot below :

DTM mobile device rule

You see? It’s that simple!

Detecting a Mobile Device on Tealium

In Tealium, it is not as straight forward as Adobe, but it’s still pretty simple. Following are the steps:

1 : Adding data source
Create 2 Data Layer elements:
  • device_mobile
  • device_tablet

(You can name them whatever you feel suits your business logic)

Step 2: Fill up your data layer values using a javascript extension

 

  • Select the add extension option -> Go to the ‘Advanced’ tab > Select ‘JavaScript Code’
  • Name your extension and paste the following code in the configuration field.
    // global var to detect mobile devices based on user agent
    utag_data.device_mobile = ((function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))return true})(navigator.userAgent||navigator.vendor||window.opera))?'true':'false';
    
    // global var to detect tablets based on user agent
    utag_data.device_tablet = ((function(a){if(/ipad|android.+\d safari|tablet/i.test(a))return true})(navigator.userAgent||navigator.vendor||window.opera))?'true':'false';
  • !!! IMPORTANT: Set the scope to ‘Pre Loader’ !!!

Step 3: Create your load rules

Detect Mobile device in Tealium Step 3
Build your load rules:
  • is Mobile true: device_mobile / equals / true (if you want to trigger things on mobile devices)
  • is Mobile false: device_mobile / equals / false (if you do NOT want to trigger things on mobile devices)
  • is Tablet true: device_tablet / equals / true (if you want to trigger things on tablet devices)
  • is Tablet false: device_tablet / equals / false (if you do NOT want to trigger things on tablet devices)

Step 4: Use your load rules / Save / Test / Publish / Have a drink (This is important)

How we can help

So that’s how you can take control of what your visitors see, depending on their device type. And there’s so much you can do with it! I hope this article was helpful. Feel free to reach out to us for any queries that you might have. Also, if you don’t have time to learn and apply the magic of analytics, that’s what we are here for! We are a crazy team of Google and Adobe Certified Analytics Experts who eat, breathe, sleep and dream Analytics. And we’ve made it our purpose and passion to electrify your business’s potential through Analytics.

Contact us here.

Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –


Implementing Facebook Pixel via Google Tag Manager

*seo stuff – Implementing Facebook Pixel via Google Tag Manager * 😀

The Importance of Facebook Pixel

Imagine this offline scenario – You own an apparel store which sells clothing for men and women. Every day, you meet and greet your customers and you even know some of them well. But one morning, instead of your regular human visitors, some black figures visit your store to shop. And now that happens everyday, all day long. No human customers anymore. Just those black figures, which you can’t even distinguish in terms of appearance, gender, age, or any physical feature, because they are all alike, all black.  Lol wtf right?

All of them are having fun at your store, loving your products, trying stuff, shopping and then leaving. At any day, you won’t even know if they are new ones or if they had visited earlier.

How then, would you know the characteristics of your customers? How would you know if more number of women are shopping, or more men? Or if most of your customers are young or middle aged?

Maybe you would know which of your products sell the most, but you would have no clue about who is buying them. You would have no clue about the type of audience that you must target in order to get more sales. Can you imagine?

Okay don’t cringe. That’s not gonna happen if you own a brick-and-mortar store. But do you own a website? If yes, there’s no way you can ‘see’ your customers while they’re exploring or shopping at your online store. It’s just like knowing that a black figure has entered your website. And it’s only legit if this thought makes you cringe. But since I’m writing about Facebook Pixel, it surely is the superhero-coming-to-the-rescue here. It gives you digital eyes, just like RedBull gives you wings. And that’s just one of the many things it does for you.

Sure we have Google Analytics and other analytics tools which collect information about visitors and you can do a doubleclick cookie integration in your GA account, but dude! Facebook knows EVERYTHING about everyone. This Mr-know-it-all knows your cousin’s wedding anniversary, and your mother’s birthday.

And in order to put this information to use, Facebook created Facebook Pixel. Facebook Pixel is a small code that we place on our website, and its function is to collect data for a myriad of goals that we can accomplish later.

The most important thing a pixel does is, umm, everything it does seems important! But okay, I’d like to describe two of the most important ones. One, it can be used for Remarketing on Facebook. You must have noticed that Facebook shows you adverts about stuff that you already have been looking for. For example, if you recently explored some online stores for track pants, be sure to see some relevant suggestions on Facebook! That’s remarketing. Facebook records your browsing activity and shows you ads based on your interests. This is accomplished by advertisers with the help of Facebook Pixel.

And remarketing has statistically been proven to improve conversion rates. Moreover, you can also use this base of past visitor to promote to them new stuff as well. This will greatly help you in refining your campaigns for optimum returns on your marketing spends.

Two, it allows you to build a lookalike audience of people who have similar interests and demographics to people who are already showing interest in your website. This means that you can target people who are similar to your current customers. It’s a great way to not only reach new people, but new potential customers.

Facebook Pixel also helps to track conversions and run effective ads. Again, so important!

Having made it clear that you must install a Facebook pixel to your website right away, let’s see how you can do it.

*seo stuff – Implementing Facebook Pixel via Google Tag Manager * 😀

Implementing Facebook Pixel via Google Tag Manager

To install a Facebook Pixel into your website through Google Tag Manager, you need access to a Facebook Business Manager account and a Google Tag Manager account. The following steps will take you through the installation process.

  • Log into your Facebook account and switch to Business Manager.
  • Open the Business Manager Menu and click on Pixels.

  • Give a name to your pixel and create it.

  • Having created the pixel successfully, you  now need to install it to your website, for which we’re using Google Tag Manager here.
  • Click on Setup and you will now be able to see a pop-up like this. Choose the first option.

  • Select Google Tag Manager from the list of tools.

  • Another pop-up will present you with the following options.

  • You can go with either of them, depending upon your convenience. If you would like to install the code manually, you’d have to copy it, create a Custom HTML tag in your Google Tag Manager Dashboard, and then paste the code under the tag’s HTML. If you go with the Quick Install, a tag gets automatically created in your GTM account.
  • Choosing Quick Install presents you with further steps which are quick, easy and smooth. Finally, publish.

  • Now log into your Google Tag Manager account to verify that the tag has been created. You’ll be able to see a Base Pixel Code tag under the Tags tab.

That’s all! The pixel starts working in a few minutes. You can now start receiving insights and tracking the performance of your website, right at your Facebook Business Manager account.

*seo stuff – Implementing Facebook Pixel via Google Tag Manager * 😀

Other Benefits

With GTM, you can not only implement this pixel but also “conveniently” pass custom data into facebook. Data like which products are users viewing, at which depth they are exiting the checkout, are they submitting any forms? etc etc

All this custom information will help you in further refining the definition of your target segment. With a refined audience segment you can expect optimum returns per penny spent. At the end of the day, its all about increasing the profits and reducing the costs and such consistent incremental optimizations can give you a huge advantage in your market.

Let me know your thoughts in the comments below.

*seo stuff – Implementing Facebook Pixel via Google Tag Manager * 😀

How we can help

Without any technical intricacies, you can install a Facebook Pixel and start collecting valuable visitor data on Facebook as well as Google Tag Manager. The next step would be to make the most out of your pixel, by deploying it for the very effective marketing techniques like Remarketing, lookalike audience and conversion tracking. And that’s what we are here for. We are a crazy team of Google and Adobe Certified Analytics Experts who eat, breathe, sleep and dream Analytics. And we’ve made it our purpose and passion to electrify your business’s potential through Analytics.

Contact us here.

Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –


*seo stuff – Implementing Facebook Pixel via Google Tag Manager * 😀

What is Data Layer?

[mashshare]

What is data layer?

Data layer is a JavaScript array (a data structure containing multiple elements) of a single object which contains data in key-value pairs. Eeeeeewwwwww. I feel criminal to sound so complex and technical! I take it back and we start afresh. Now before discussing what a data layer is, let’s see how and why it came into existence.

When it comes to running a website or an app, we all need some information about our users to enhance their experience at our website (or app). For this purpose, we use analytics and tag management tools, which collect this information in the form of actionable data.

While using a Tag Manager, this data is obtained directly from the HTML of a website, with the help of JavaScript. For example, when a user visits a website, HTML records his activities such as page views, button clicks, log in/out, purchases, downloads, etc. Do you realize that in order to collect data at so many points of action, we need to write separate JavaScript snippets for each?

That’s not the only bugbear here. What if the HTML of our website undergoes some changes? For example, let’s say the button ID of a button accidentally got altered by the developer. Lol what a stupid developer! But shit happens and to err is only human.

Now, thanks to this developer, we have a brand new button ID and our JavaScript snippet has no idea about it. What happens? It stops working! We’ll now have to make appropriate changes in our JavaScript to keep obtaining data from that button.

So, Problem Number 1 – Multiple JavaScript codes. Problem Number 2 – a constant sync must be maintained between the HTML and the JavaScript that accesses it.

The solution? Data Layer, duh.

To solve the problems mentioned above, some cool technical creatures came up with the concept of a Data Layer. It is a layer between the HTML and the Tag Management System (or any data collecting tool) which collects data from the HTML, and passes it to the Tag Management System or other data collection tools. It holds all the data we want to pass from our website to our linked applications.

In technical terms, HTML is called the Experience Layer and the Tag Manager resides at the Application Layer. So the flow of data is from Experience Layer to Data Layer to Application Layer.

To be honest, I also feel criminal to make a very important tool like data layer look like it’s nothing. Or am I cool? Cool or criminal? Maybe I’m angelic to help you understand it easily. O:)

Let’s keep it simple and see what data layer looks like in the real world. In implementation, data layer is a set of codes. Codes that hold data required by applications such as Tag Managers or Analytics tools. Requirements specified by the Analytics/Marketing team are converted into a JavaScript snippet by the developer, and this snippet is inserted into the website.

And what I took back in the start of this article, is what a data layer actually is. It is a JavaScript array of a single object which contains data in key-value pairs.

An array is a data structure containing multiple elements. To define, for example, an array named A, we follow either of the following syntaxes –

var A = new Array();
or
A = [];

Here ‘A’ is an empty array. So the JavaScript snippet to create an empty data layer would be –

datalayer = [];

So our data layer has been created. Here ‘datalayer’ is just a name. You can give any name to your data layer, even though there are some default names specified by different Tag Management Systems, and it’s recommended that you go with the defaults. Google Tag manager calls it dataLayer, Tagman uses tm_params, Tealium calls it utag_data and Qubit calls it universal_variable.

Inside the data layer, is a single object. And since we include objects within a pair of curly braces, this is how the structure of a data layer looks –

datalayer = [
{
}
];

Everything included within these curly braces forms a single object. Here is an example structure of a data layer.

How does a Data Layer help

I – Specific and refined data

A data layer only holds the data needed and specified by a business or an application. For this reason, it is also considered to be a refined list of business requirements.

II – Data layer speeds up the process of deployment of tags.

Now since data layer creates a direct passageway for data to flow from the website to the Tag Management System, without running multiple JavaScript snippets, the whole process becomes faster and smoother.

III – Data layer helps you get the most out of a Tag Management System

The Data layer is one of the key concepts in the world of Tag Managers. The tools work best when deployed using the data layer, as it ensures maximum flexibility, portability, and ease of implementation.

IV- Data layer allows the Analytics and Digital Marketing team to conveniently make changes on the website.

Since the mess of numerous JavaScript codes gets cleared, the constant dependency on developers for making changes to data tracking codes and resolving issues is greatly reduced. It also relieves the web developers equally, leaving them to get on with implementing new features and fixing bugs.

Best Practices in Data Layer’s Implementation

  • Business Objective Document

Writing down the requirements and objectives of an organisation is the first step in creating a data layer. This practice gives a vision and a clearer understanding of what information the data layer must collect and how.

  • Multiple Data Layers

Each team within an organisation has its own set of goals to achieve, which collectively help the organisation to achieve its basic goal. Since every goal requires distinct data, distinct data layers must be created. Each data layer will collect data that is specific to a particular goal. Hence, we recommend separate data layers for Analytics, Marketing and other tools.

  • Consistent Naming

Keep the names of your data layer and variables simple and readable. One way to do this is by using lowercase and underscores instead of camel casing. For example, use ‘page_id’ instead of ‘pageID’. The names must also be relevant and descriptive.

Example Data Layer

Suppose an online store comprising thousands of women’s bags, needs to know their most popular products. So the goal here – To find out the type of products being loved the most.

The ‘type’ here could be dark colored handbags under 1499 bucks, or luxury wallets that cost over 2999 bucks. Hence, our data layer must record some crucial attributes such as product category, price range, physical attributes, along with the product name of course.

A data layer for the same (holding some values) must look like –

datalayer = [
{
'product_name' : 'Black Fringed Wallet'
'product_category' : 'Wallets'
'color' : 'Black'
'price' : 899
}
];

Notice that the goal is fully met by making sure that only the data specific to the company’s requirements is collected. Insights formed on the basis of this data will help the company understand the preferences of its customers. If most of the visitors viewed bags which are dark colored backpacks priced between 1399 and 1899 bucks, the company can come to conclusion on what’s trending the most.

Also notice that the names of variables are simple and fully understandable.

Similarly, another data layer for the same company could track purchase-related data, in order to know which type of products are bought the most. Multiple data layers can be (and must be) created to achieve the various goals of the company.

How we can help

To sum up, data layer is a technical thing. And it is the key to get the most out of a Tag Management System. Even though you don’t need a lot of JavaScript knowledge to deploy tag management tools like Google Tag Manager, you definitely need it (or a JavaScript expert) to write a data layer. And that’s what we are here for. We are a crazy team of Google and Adobe Certified Analytics Experts who eat, breathe, sleep and dream Analytics. And we’ve made it our purpose and passion to electrify your business’s potential through Analytics.

Contact us here.

Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –


What is Google Tag Manager?

What is Google Tag Manager?

Google Tag Manager is a problem-solver. It’s a lifeguard that has come to rescue anyone who is drowning in the ocean of tags (JavaScript snippets that send information to third party). Google Tag Manager, or GTM, is a super useful tool that simplifies the task of managing tags. Simplifies? I think GTM has made it the simplest ever!

With Google Tag Manager, you no longer need to hard-code JavaScript into each page of your website for collecting information about the behaviour of your visitors. Instead, you can now use Google Tag Manager’s interface to add, update or manage tags – mostly without writing JavaScript. You no longer need to chase your developer (who somehow happens to be the busiest person on the planet) for the task. With GTM in your hands, it’s all in your hands. Feeling powerful? Happy realization!

Apart from making you realize the power you now have, we are here to help you put GTM to work! Go ahead, click here to make a wish. #GenieVibes

Why you need Google Tag Manager

You need to upgrade

You need GTM because to stay ahead of the league, you need to say good-bye to the old practice. You need to upgrade. Without GTM, for performing tasks as simple as tracking the number of button clicks, to as complex as tracking scroll depth, or even making the tiniest changes to your already existing snippets, you had no choice but to seek a technically blessed creature.

GTM greatly reduces your dependency on a developer

GTM provides a handy, step-by-step interface which allows you to create and manage all your tags at one place. Without actually coding a snippet, you just follow some simple steps to create a tag and specify when and where it gets triggered. GTM handles the rest!

GTM reduces your expenses

A developer takes hours to write codes for the various tasks you want your website to perform. A GTM expert on the other hand, makes it possible in a much lesser time, which means you pay less for the same work.

GTM boosts your system’s speed and efficiency

To make advancements, you come up with changes to your existing system. You take decisions. And then? The most complex of all – Implementation. Those time-consuming implementations that take multiple steps to go live, can be centrally handled with Google Tag Manager.

With features such as debug, preview, security, integration with Google Analytics and many other Google products, there’s no end to what you can do – all at one place, efficiently.

Perks of Google Tag Manager

The list is huge, but to name a few,

  • Debug

After having created a tag, you can use this built-in error checking tool to make sure your tag works fine and smooth.

  • Preview

The preview mode gives the user a preview of the real-time performance and accuracy of a tag.

  • Security

You can set up a two-factor authentication that requires both your normal password and a numeric code that you receive over an sms, voice call, or mobile app. You can also manage permissions at different levels of the account.

  • DIY

You can Do It Yourself. By just inserting a container tag to your website, which is a one-time task, you can start creating tags, debug and preview them so as to have the whole idea of and control over what you’re doing!

  • Google Tag Manager +  Google Analytics

Even though both the tools can work independent of each other, when you team them up, they rock! Google Tag Manager simplifies the implementation of services provided by Google Analytics.

  • It’s free of cost

The tool, yes.

How we can help

Just in case it’s difficult for you to take out time and learn how to deploy Google Tag Manager and Google Analytics, we’re here! We are a crazy team of Google and Adobe Certified Analytics Experts who eat, breathe, sleep and dream Analytics. And we’ve made it our purpose and passion to electrify your business’s potential through Analytics.

Contact us here.

Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –