What is considered “direct traffic” in Google Analytics?
Direct Traffic represents visitors who typed the URL directly into the web browser, clicked on a bookmark to arrive at your site, or clicked on an untagged URL in a desktop based application that link to your site.
Here is a simple example to illustrate the issue:
You are a web analyst at forever21… you ran a huge online campaign for the back to school sale (banner, email, social media, affiliate,..) now you want to measure your brand awareness in the market. You want to see how many people because of your branding efforts visit your website directly by typing your URL?
A few months after the end of the campaign you still see visits are tracked as “paid search”, “email” and “banner”. You see a very small number of “direct” visits. In the budgeting meeting you shared the numbers with the board and you decided to spend more $$$ on marketing because you haven’t reached your brand awareness goals yet.
Hold on! Do you know that most of these “paid search”, “email” and “banner” visits that you see today in your report are “direct” visits?These campaigns did their job months ago and now the whole universe knows about your brand and comes to your site directly. Unfortunately, you have no insight about these “direct” visits because of the rule that “direct” visits do not override previous traffic sources for 6 months!
Can we change this rule? If this will answer your business needs and save you money, of course we can 🙂
Simple! Just credit visits to the last campaign/traffic source regardless of whether the visit was a direct or non-direct visit. See the table below for a comparison between the default GA reporting settings and the “True Direct” solution settings:
Visitor | Visit 1 | Visit 2 | Visit 3 | Visit 4 |
Source / Medium | cnn.com / Referral | ask / organic | Direct Access | Bookmark |
Last Click Attribution | cnn.com / referral | ask / organic | ask / organic | ask / organic |
True Direct Attribution | cnn.com / referral | ask / organic | direct / none | direct / none |
We will need to run some JavaScript code before firing the Google Analytics tracking code. This JavaScript code will check:
Why do we check whether the current page is tagged or not?
Sometimes pages are loaded without referring information, yet they might have been manually tagged with campaign parameters to force GA to credit the visit to a certain channel. We do not want these pages to be overridden by our “direct” parameters.
Example:
The traffic source for this visit will be:
Let us explore the code, section by section:
function get_referrer() {
var source = document.referrer;
if (source == null || source == “”)
return “direct”;
}
This portion of the code will determine the URL value of the page that loaded the current page (referring page). If the value is NULL, the function will return “direct” indicating that the current page was not referred by another site.
function get_parameter() {
var urlstr = window.location.href;
var results = urlstr.match(/[\\?&#]utm_source=([^&#]*)/);
if (results != null)
return “tagged”;
}
This portion of the code will determine if the current page is manually tagged with Google Analytics campaign parameters.
if (srcPage == “direct” && parameter != “tagged”) {
window.location.hash = “utm_source=(direct)&utm_medium=(none)&utm_campaign=(not set)”;
}
This portion of the code will check the values returned by the two functions above. If the visit has no referring information (direct) and the URL is not tagged with any Google Analytics campaign UTMs, then the page URL will be updated with Google Analytics UTM parameters setting the source and medium for the visit to “direct”
Page URL
New URL
set)
* Notice that we did not use window.location.href function because this function will reload the page with the new URL, which is not what we want to happen. We just want to update the URL, without affecting the visitor experience, in order for the Google Analytics tracking code to attribute the visit in a certain way.
In my opinion, these branded searches should be dealt with as direct visits. In GA we have the option to do that so if you are convinced, then let’s configure Google Analytics to treat certain search terms (our brand) as direct traffic.
The configuration has to take place at the code level. It will be simply adding the _addIgnoredOrganic() method inside the Google Analytics tracking code for each keyword we want to track as direct traffic.
The custom Google Analytics tracking code will look like this:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-xxxxxx-x’]);
_gaq.push([‘_setAllowAnchor’, true]);
_gaq.push([‘_addIgnoredOrganic’, ‘e-nor’]);
_gaq.push([‘_addIgnoredOrganic’, ‘e-nor.com’]);
_gaq.push([‘_addIgnoredOrganic’, ‘www.e-nor.com’]);
_gaq.push([‘_trackPageview’]);
(function () {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Congratulation, now you don’t only have access to the direct visits data of those who visit your site for the first time as direct, but you will have insight into all direct visits regardless of whether they took place during the first, second or even the tenth visit.
As consumers become increasingly digitally savvy, and more and more brand touchpoints take place online,…
Marketers are on a constant journey to optimize the efficiency of paid search advertising. In…
Unassigned traffic in Google Analytics 4 (GA4) can be frustrating for data analysts to deal…
This website uses cookies.