Skip to content
Which Channels Drive New Users to Your Hotel Website 2

Which Channels Drive New Users to Your Hotel Website?

mThe Source/Medium report is by far the most popular one within Google Analytics, the one considered the most interesting by all business sectors, including the Hotel Industry of course.

If you want to know where the traffic to your hotel website comes from, this is the report you’d need to consult.

This report, though, takes into account all Sessions that happened for each source. So, what if you want to know what is the one single channel that drove the very first Session, for each and every User?

In other words, which source should you credit for each potential customer landing on your website?

This is what this post is about. In here, you’ll learn how to track the Initial Source of Traffic to your hotel site, by using Google Tag Manager.

Ready? Let’s start


Quantity & Quality Data Analysis.

Speaking of Sources and Mediums, a report in Google Analytics looks like this:

Source/Medium report in Google Analytics (UA)

Google Analytics is the go-to tool for quantity analysis, as it aggregates all the data collected on your website and shows you the total numbers.

As we know though, the typical booking journey involves several sessions before users reach the point of purchase, meaning the booking moment.

Even more so for leisure travellers. And even more so in these post-pandemic times.

A long and thoughtful booking process. Just consider that, on average, users visit 42 different websites, from the moment they start looking around for travel-related services to the moment they complete the reservation.

However, no matter how long this process is and how many times a user lands on your website, every single Session comes with a Source, also known as Referrer.

But here stands the problem: Google Analytics assigns a Source and a Medium to each visit that you get. If a user visits your website 5 times before completing a reservation through your booking engine, what’s the source that you should credit for bringing in that booking?

Let’s assume the following Source/Medium in a given example where users A, B and C perform 2 visits (sessions) each:

  • User A:
    • Visit 1 = google / cpc
    • Visit 2 = googlehotelads / metasearch
  • User B:
    • Visit 1 = googlehotelads / metasearch
    • Visit 2 = google / cpc
  • User C:
    • Visit 1 = google / organic
    • Visit 2 = google / cpc


The Source/Medium report would look like this:

Source / Medium Users Sessions
google / cpc 3 3
googlehotelads / metasearch 2 2
google / organic 1 1

Take, for example, google / cpc.

2 users out of 3 came from it. Yet, only 1 user landed on your website for the 1st time, thanks to your paid campaigns on Google.

However you can’t actually see this additional information within GA.


Why is the 1st Session different?

At this point I guess you might be asking “what makes the 1st session different from all subsequent visits?” And why is it so important?

In simple words: you might have the best hotel website in the world, but if you don’t bring your potential customers to visit it first, they will never know.

This means that all the efforts that you put forth to select the best room photos, the best copy, the best CMS and the best hosting service to make your website super beautiful and fast will eventually help you get returning visitors, but very little will they do for you to bring new users.

Thus, knowing which channels drive these new visitors becomes of paramount importance to understand what works and what does not work, where to invest your marketing budget and where to cut it.


If you torture the data long enough, it will confess to anything.

If you want to stress and narrow further your data to reveal some more granular and useful information, you need to instruct the tool to do so for you.

The Initial Source of Traffic is one of those attributes that sets you for a more qualitative analysis.

So how do we set up Google Analytics to include this information?

If you have been using Google Tag Manager to deploy Google Analytics, just keep following. If you don’t work with GTM… start working with GTM. Then come back and follow, too.


How it works.

Before getting into the operational and technical aspects of how to set everything up, let me brief you on how this all concept works, so that later you will know where to put your hands on.

  1. Detect source and medium: first we need to know where the users come from. In Google Tag Manager there is no such information, so we have to manually write the code that does the job.
  1. Set the cookie: once detected source and medium, we need to store those values somewhere and somehow. We will do that by using a cookie. This cookie will be valid for 2 years, just like a User is considered as such, in Google Analytics.
  1. Read the cookie: at every User’s visit within these 2 years, the tag we will set up in GTM will first check whether the cookie already exists. If so, it will do nothing (if it exists, it’s because it’s a returning user). If it does not exist, it’ll create one from scratch (this is a new user).

In summary that’s pretty much it. Now let’s see how we are going to set everything up.


A cookie that does the job.

The magic happens thanks to a very simple cookie, in which we will simply store the information about the source and medium of each user.

This way these source and medium will be remembered in case those new visitors will come back to visit our site again.

All you need to do is copy the piece of JavaScript code that you find here.

Disclaimer: I took the original cookie code from the great Julius Fedorovicius, Founder of Analytics Mania and one of the greatest data analyst and GA expert in the world, and slightly changed it to better suit the Hospitality needs. So all credits to him.


Setup in Google Tag Manager.

Once copied, head to your Google Tag Manager account >> Tags >> New.



Type: select Custom HTML.



In the text-area that will appear thereafter, simply paste the code from the link above, and name your new tag as you wish.


Now, click on the Advanced Settings toggle and apply the following settings:


This last screenshot maybe deserves a quick explanation.

As we said, the tag is supposed to first check if a cookie with already stored values for source and medium exists. If not, it creates one.

So, logically, this code needs to be executed before a PageView hit is sent to Google Analytics.

Thus, with the above Tag Sequencing option we are simply instructing Google Tag Manager to do just that.

Finally, at the end of our tag configuration page, we can now select the trigger, meaning the rule that will make this code fire.

Simple as that, the rule is All Pages, as we want this check to be happening everywhere on the website and booking engine, no matter which page users land on.



Set the Custom Dimension in Google Analytics.

Now we need to connect GTM and GA, so that the latter receives the Initial Traffic Source to let you use it in your reporting.

All we need to do is create a new Custom Dimension.

In your Admin panel, select Custom Dimensions under the Property column.


Create a new one that looks like this:

  • Name = Initial Traffic Source
  • Scope = User
  • Active = Yes (checked)


When hitting the Create button, you’ll be presented with a window that looks like this:


In red, I underlined the one value that you need to remember, in my case is dimension1.

1 simply represents the index number of this specific dimension. If you happen to create more custom dimensions in the future, you’ll see the index increasing by 1 every time.

But for now, just write that number down on a piece of paper.


Quick Recap before moving forward.

Let’s recap what we’ve done so far.

We have created the code that writes the Initial Traffic Source cookie in user’s browser. Also, we have prepared Google Analytics to receive this value.

Now all we need to do is tell GTM how to first read and then send the value of our newly created cookie to Google Analytics.

It all sounds very techy, right?

But believe me, no more coding will be needed from now on. After all, that’s one of the main reasons why GTM exists.

So let’s see how to do it.


Read the Initial Traffic Source cookie.

Reading the value of any given cookie in GTM is as easy as falling off a log.

In your Variables menu in Tag Manager, simply add a new variable and when the Choose variable type window slides in, select 1st Party Cookie.

Cookie - Initial Traffic Source

Next, just give your variable a name, like Cookie – initialTrafficSource. This is totally up to you.

What is not up to you to choose, is the the Cookie Name. If you did copy/paste the code I provided you with, at the beginning of this article, the value that you need to enter is initialTrafficSource.

Cookie - Initial Traffic Source - Setup

And that’s really it.

See? How powerful can GTM be when making technical stuff so much easier to manage for everyone?

Now we have a variable that automatically reads the value of the Initial Traffic Source cookie we’ve set up before. Now let’s see how to use it.


Send the value of Initial Traffic Source.

We’re almost done. The last piece of the puzzle is just about that dimension1 you just wrote down on your paper.

Now we need to tell GTM how to send the information that we previously stored in the cookie about the initial source of traffic.

More specifically, the source of traffic will be sent over to Google Analytics using the custom dimension you just created.

Here’s how you do it.

First and foremost, edit your Page View Tag in Google Tag Manager. In here and if not done already, tick the box next to Enable overriding settings in this tag.


By doing so, a new set of options will open underneath.

Open the toggle More Settings and then Custom Dimensions.


After clicking +Add Custom Dimension, set the Index field with the value 1.

Remember the dimension1 I asked you to write down on paper? The value of 1 in the Index field represents the dimension index (dimension number 1) to which you will be sending the value of your cookie, which will contain the initial source of traffic.

In the Dimension Value field, you should simply enter the name of 1st Cookie Variable you’ve created a moment ago.

If you don’t remember its name, just click the + icon next to the field:


And choose the variable:


The final result should look like this:


That’s it, now you can save your tag.


Test, check and confirm.

Never ever give things for granted, so let’s test whether everything works as expected before publishing all the changes we’ve done.

You might have noticed that I haven’t showed you anything about how all these changes will impact your Google Analytics reporting. Nor have we seen whether everything works.

So let’s do this now and together.

First and obviously, let’s see in Preview Mode.

My lab rat is always my Demo Test Hotel, available at this link:

1) Let’s check that the tag containing the instructions to set up the cookie fires as expected:


2) As said, after setting the cookie, we need to read its value, so let’s check whether the 1st Cookie Variable contains the information we want:


In fact, I opened the my demo hotel website from Google organic search.

3) We set the cookie, we read its value… now we need to check whether this value (google/organic) is sent along with a custom dimension that we have set up within the Google Analytics Page View tag:


Bear with me if I quickly ran through this test/preview mode phase without explaining every single details of how GTM’s preview mode works, but if you are a bit familiar with GTM, the above checks would be more than enough.


Initial Traffic Source in Google Analytics Reporting.

Ok, everything is up and running. Now we can finally enjoy our new dimension in basically all our reporting in Google Analytics.

Logically, the very first report we might want to try to apply this new dimension is the Source/Medium report (Acquisition >> All Traffic >> Source/Medium).


In the above example, we’re using the Initial Traffic Source as a secondary dimension.

As you can see, next to the quantitative information provided by Google by default, we now have a more qualitative KPI that tells us way more about who we should credit for bringing in new visitors to our hotel websites.

As said, this is just an example, but you can use this new dimension in any report that you want and also create new custom reports and use Initial Traffic Source as a primary dimension.

For example, what I usually find very useful is too see which sources bring in more users, revenue and reservations based on revenue-related KPIs, such as the Length of Stay.


Conclusion… for now.

This is it for now. Because in reality it’s really not it.

In the next few days I will be updating this post with an extra step that in my opinion you should consider taking, to make your data tracking even more reliable and efficient.

So, what else can I say? Just stay tuned 🙂


Leave a Reply

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

Free ‘Case Study’
How to get more clients with data and advertising.