Google Analytics Goals (100+ New Analytics Hacks 2019)

Google analytics goals 2019

100+ New Google Analytics Goals 2019

One of the most important concepts in web analytics is the conversion, the transformation of a mere website visitor into a customer. The actions that define conversion may be any type of user interaction that is valuable to you, from major (purchases, contact requests) to a minor (content engagement, newsletter signup). 


This blog explains the 100+ new hacks for Creating and Organizing Goals Google analytics 2019.  And also explains how to set up a destination goal with a funnel 2019.


Google Analytics allows you to specify the interactions that you want to consider as conversion through goals. 

Google Analytics has four kinds of goals:

Google Analytics

Destination goals, the most common type, are based on the URLs of pageviews. Typically they are used for a confirmation or thank-you page of some kind that indicates the user has completed a process. Destination goals can also have a funnel, a series of steps leading up to the final destination page (a series of forms that must be filled out, etc.).


Session Duration and Pages Per Session goals are based on those metrics exceeding a given threshold (the user spent more than 5 minutes on the site, or viewed more than 3 pages).


Event goals are based on events, the non-pageview interactions for measuring activities such as downloads, outbound links, or video plays 


In many cases, these goals are straightforward to create, based on the tags and triggers you’re already using in Google Tag Manager. However, in some cases where URLs don’t change, such as dynamic, AJAX-driven processes, you might require additional tags and triggers in Google Tag Manager to accommodate.


This blog explores the setup of goals in Google Analytics and any tags and triggers in Google Tag Manager that are necessary to deal with such situations.




Notice that none of these goals represents actions by the user that aren’t already available in Google Analytics data. What good, then, are these goals?


First of all, creating goals forces you to actually think about why your site exists and what you’d like your users to accomplish.


Within Google Analytics, creating goals elevates these particular actions in importance in the way Google Analytics presents them in its reports.


Goal metrics such as conversion rate are easily accessible across all of the types of reports in Google Analytics, as well as enabling further analysis through tools such as the multi-channel funnel reports.


The accessibility of goal metrics in reports makes it easy and straightforward to make comparisons and find your most valuable audiences and marketing channels. Without goals, you’d have to dig harder, using segments and other tools in reports, to come to these answers.


You can also assign monetary values to the goals you create in Google Analytics, and there are metrics that let you compare these values in your reports as well.


If there are actual purchases being made on a website, you can capture those with e-commerce tracking; but for other types of sites, you may still be able to assign a real-world value to the goals.


For a lead generation process, for example, you may be able to gather data from outside Google Analytics (out of 1000 leads from the website over the last year,10% resulted in a sale, and the average value of a sale was $500), resulting in an average value per lead (in this case, $50, if you do the math).


Alternatively, if there aren’t any conversions on your site that you can tie to real-world monetary values, you can still use the goal values as a way of weighing their importance. Maybe your primary goal is $100, a couple of secondary goals are $50 each, and some minor goals are $10 each.


Creating and Organizing Goals


Goals are created within each view in Google Analytics. You’ll find any goals you’ve created and the ability to create new ones in the view column of GA’s Admin settings 


Setting up goals, like any other changes to the Admin settings in Google Analytics, does not retroactively reprocess existing data in reporting views. Creating a goal will measure conversions for that goal going forward.



Google Analytics

Let’s walk through how to create a goal in Google Analytics. In the Goals section of the View column in GA’s Admin tab, select the + New Goal button.


  • Enter a name for the goal. The name will be the label that displays for the goal in your Google Analytics reports, so be sufficiently descriptive that it’s obvious to anyone using your data what the goal represents.


  • Optionally, choose a goal slot. As noted, each view has 20 goal slots. These are divided into four sets of five goals each, which correspond to groups of goals viewable in reports.


  • By default, Google Analytics simply uses the next open slot, but you can change this (for example, if you want to put the most important goals first and less important ones last).


  • Choose a goal type: Destination, DurationPages/Screens per session, or Event. Then select the Next button to provide the goal details.


  • Depending on the type of goal you’ve selected, in the next step Google Analytics asks you for the details of the goal:


  • For Destination goals, you enter the URL(s) of the goal page, and optionally of funnel pages for steps that lead up to the goal. This type of goal is explored in detail in the next section.


  • For Duration goals, specify a time by entering numbers for hours, minutes, and seconds. If a session’s duration is longer than the time you enter here, Google Analytics will count the goal conversion.


  • For Pages/Screens per session goals, specify the number of pages. If a session contains more than that number of pages (or screens for mobile apps, Google Analytics will count the goal conversion.


  • For Event goals, you can specify one or more criteria for the category, action, label, and value of the event(s) to count as a goal conversion. If you set more than one criterion, all of them must be true to count as a goal conversion.


Optionally, for any type of goal, set a currency value. (For Event goals, you have the additional option to use the event value for the goal value.)


  • Use the Verify this Goal option to double-check your goal setup. This compares your goal setup to data from the last seven days and shows the number of conversions that would have been recorded. If you get 0 but you know you have had conversions, check your setup for typographical errors in URLs, event properties, and so forth.


  • Select the Create Goal button to save the goal.
  • Google Analytics will start calculating conversions for this goal in your reports from this point forward.


Deleting Goals

If one of your goals is no longer relevant, you can disable it with a toggle in the list of goals, which hides it from view in your reports.


Notice, however, that there is no option to delete a goal. Like all Google Analytics data, once data is in reports, there’s no going back in time to change it (including deleting the existing goal data).


You can, however, reuse the slot for a goal by simply changing its name and all of its settings. From that point forward, data in that goal’s slot will be for the new goal, and backward for the old.


Tip there’s no indication in GA’s reporting interface when a goal’s setup has changed, so you should provide an annotation, and consider including a date in the goal’s title to be clear about changes.


Destination Goals and Funnels

Google Analytics

The most common type of goal in Google Analytics is the Destination goal, which indicates that the user has reached some particular page (defined by URL). Usually, this is a page reached at the end of some process, a confirmation page reached upon completion. However, it could be any important page on your site you want users to reach.


For goals that have a set of steps leading up to the final destination, you can create a funnel. Google Analytics will show progression through this funnel so that you can understand where the process may have leaks or bottlenecks that prevent some users from completing the goal.


There are two reports in Google Analytics where the funnel data is shown, the Funnel Visualization and Goal Flow reports (both found in Conversions ➤ Goals). These reports offer different visualizations, with different levels of detail into behavior.


Note  A goal’s funnel setup affects only these funnel reports. All other metrics in Google Analytics based on the goal (conversions, conversion rate, value) only look at whether the final goal destination is reached.


Funnels are designed for a sequence of steps that a user goes through in order to complete some process. This sequence might include an optional step, or have the possibility to go backward to a previous step, but there is an implied order to the funnel, from first step to last.


You should only include steps in the funnel that a user progresses through to get to the goal in a particular order. If the pages can be viewed in any order, the funnel reports will not show especially useful data.


Setting Up a Funnel


Before setting up the goal funnel, you’ll need to know the URL of each step in the process. Depending on what the process is, it might be easy to walk through on the site (fill out the contact form and say “Sorry, just testing”) to see what the URLs are.


In other cases (purchases, account registrations, etc.), the processes may be more complex or difficult to test. You may need to use a test version of the site or consult your documentation or developer to understand the process and the sequence of URLs involved.


In some cases, you may encounter a sequence of steps that don’t have any distinction between URLs. You’ll explore how to tackle these later in the blog.



Assuming you’ve already gathered a list of URLs of the steps in your process, let’s set up a destination goal with a funnel.

Complete steps 1–4 from “Create a Goal in Google Analytics” and choose Destination as the goal type.


1. For a Destination goal, the first goal detail setting to enter is the final URL destination for the goal. This represents the conversion: if the user reaches this page, the conversion occurred; if not, it didn’t.


2. Enter URLs here just as they appear in reports in Google Analytics, typically beginning with the path (excluding the hostname). There are three matching options:


  • Equals to: The URL must match exactly what is entered, no more and no less. This is the default and works fine in many cases, but where you need more flexibility, the next two options are available.


  • Begins with: The URL must begin with the string entered but could continue with additional text at the end of the URL. This is quite useful for URLs that have many possible variations according to the user making a choice or entering information in a form. 


  • Regular expression: The URL must match the regular expression pattern. This allows a large degree of flexibility for matching patterns from general to specific.


3. You also have the option whether the URL you entered should be case-sensitive (which is almost never needed).


4. Enter the full URL, partial URL, or regular expression pattern for the final goal page.


Optionally, assign a monetary value to the goal.

  • To create a funnel, turn the funnel option to On. A list will appear for you to list labels and URLs for each step.


  • For each step, the Name is simply the label for the step in the funnel reports. The Screen/Page is a URL or regular expression pattern for the step. The funnel URLs follow the same rules—Equals to, Begins with, or Regular expression—chosen earlier for the final goal URL.


  • You can add as many steps as necessary that precede the final goal page (up to 20, although if a process is 20 steps long, you should probably rethink the user experience). You don’t need to repeat the goal URL in the funnel steps; the final goal URL is always considered the last step.


  • Finally, notice that the first step has an additional option, whether it should be required. This is further discussed later in the blog and situations where it’s appropriate.


  • Use the Verify button to check the goal. Note that the Verify button only tests the final conversion, not each individual funnel step. (More advice on testing and verifying funnel URLs to come.)


  • Select the Create Goal button to save the goal.
  • Google Analytics will start calculating conversions and funnel data for this goal in your reports from this point forward.


Required First Step

Google Analytics

Finally, there’s one additional option that useful in some scenarios: the required step option on the first funnel step. Notice that the funnel reports show users entering the funnel at any step in the process. Often, that’s the first step, but it could be a subsequent step.


How does this happen? You may think it’s not possible; there’s no way to get to Step 2 of the registration process without going through Step 1! Nevertheless, it can happen in a variety of edge-case scenarios, like this:


Hey, we should get tickets to go to Alice’s Wonderland Resorts! I’ll go to Step 1.


Wait, I should ask the Mad Hatter if he wants to come along with me. I’ll just leave this open in my browser until I find out. More than 30 minutes go by, and my session expires in Google Analytics.


OK, now I’m ready to reserve those tickets! I go on to Step 2, but since my session expired, Google Analytics shows me entering the funnel at Step 2.


In most cases like these, the bulk of users enter at the first step and a handful at subsequent steps. However, in some scenarios, you might only wish to see users who completed the full process.


The first two steps are a sign-up process, giving the users access to a page with some downloadable resources. The final page can be bookmarked and returned to by those users, who do that often (which is why you see so many of them enter at the final step). But the users you’re really interested in are just those who actually signed up in Steps 1 and 2.


By setting the Required setting on the first step of the funnel, the funnel reports show you only users who began at Step 1. Note that this affects only the funnel reports; the number of conversions overall for the goal is always determined only by the final destination URL.


Funnels Without Distinct URLs

For funnels where the steps are easily differentiated by URL, the goal setup is pretty straightforward. What happens in a situation where the funnel steps aren’t easily differentiated by URL, such as the following:

  • A modal popup appears within a page
  • A form and its confirmation page have the same URL


  • A checkout or signup process has several steps that occur within a single page without reloading (known as AJAX)
  • A process where one or more steps occur at an external, untracked website


The approach for setting up funnels in these situations is to use virtual pageviews—that is, to trigger a Google Analytics pageview on some interaction like a form submission or a click a button that advances to the next step, and use a concocted URL to represent the interaction.


GTM’s Google Analytics tag allows you to override the current page’s URL with a URL of your choice using the page field in the Fields to Set section.


For the virtual pageview, /drink-imaginary-tea is the URL chosen to be recorded—a URL that doesn’t actually exist on your site, but that you’ll see in your Google Analytics data to represent the action that was performed.


Because these actions are recorded as pageviews in Google Analytics, you can then use the URLs you chose to set up the funnel (and you’ll also be able to see the page views in the Site Content reports).


Note  For external websites, such as a third-party payment site, if you can put your Google Tag Manager container code on the site, you can use cross-domain tracking to capture data.


If the third party doesn’t allow your code, activity by the user on their site is invisible to you, but you can at least track users leaving your site to go there.


Modals and iFrames

Google Analytics

modal is a popup that occurs within a page (rather than as a separate tab or window within your browser).


This modal popup could contain two different types of information:

Often they use the iframe HTML element to simply include another page within. In other cases, such as a lightbox for images, they might simply show/hide or restyle elements of the page content.


To check the content of a particular modal popup on your site, you can simply inspect the source code. If the iframe element is used, there is actually a distinct page for the content of the modal.


As long as your Google Tag Manager container is on that page, you’re measuring it just like any other, and a pageview for that URL will appear in Google Analytics, just like all your other pages show up.


Note If the page within the iframe is on a different domain, you need to use cross-domain tracking. There are some additional browser and security issues regarding cross-domain iframes; see the Google Analytics developer documentation for details on handling this scenario.


For models that do not use an iframe element, you can use the Click trigger to trigger tags. It’s up to you whether you want to trigger a Google Analytics event tag or pageview tag, depending on the nature of the interaction and how you want to be able to see the data in Google Analytics. For an image in a lightbox, an event tag might be most appropriate.


If there’s a form or other multi-step process within the modal popup, however, you might want to use a page view so that you can set up a destination goal with a funnel.


[Note: You can free download the complete Office 365 and Office 2019 com setup Guide for here]



Google Analytics clicks

To create a virtual pageview for a click, think back to the process outlined when you triggered a Google Analytics event tag based on a click. Here, you’ll swap out the Google Analytics pageview tag instead.

Create a new tag. Choose Google Analytics ➤ Universal Analytics as the type.
Fill in the Tracking ID with the {{GA Property ID}} variable that you previously created.
Select Track Type ➤ Pageview.
Under More Settings ➤ Basic Configuration


you’ll find a field labeled Document Path. This is the URL recorded by Google Analytics. By default, the current page path is used, but you can override that label here. (This is the essence of your “virtual pageview”: you’re creating a URL that doesn’t actually exist to represent the form submission.)


You can use any combination of text and variables here to construct a URL. Often it makes sense to use the current page (the {{Page Path}} variable) and append some label to the end:


{{Page Path}}/modal-newsletter-signup
Now specify a trigger for the tag.
Choose Click, then select the New button to create a new click trigger.
specify some criteria to restrict the click trigger to the appropriate link, button, or another element.


Note  Here it is not necessary to use the “Wait for tags” option of the Link Click listener since the current page remains open after the click.

select the Create Trigger button, giving the trigger a name: “Modal Popup”. Google Tag Manager saves the trigger and returns to creating the tag.
Save the tag, giving it a name: “GA – Pageview – Modal Popup”.


Forms and the Form Listener



HTML form elements allow the user to fill out a number of input fields and then submit the form. The contents of the input fields are submitted to a URL for processing by your site (represented in HTML by the action attribute of the form element).

<form id="red-queen" action="/off-with-her-head/">
<input id="first-name" name="first-name" type="text" placeholder="Alice"> <input type="submit" value="Submit!">


If the URLs are different for the page that includes the form and the action of the form, you can easily differentiate these steps in a funnel. In some cases, however, the action of the form may be the same as the current page.


After the form is submitted, the page may show different content (a confirmation message, for example), but the URL is the same.


In cases where you can’t differentiate a form by URL, you can track submissions of the form using GTM’s Form trigger. The Form trigger is similar to the Click trigger but instead listens to see if the HTML form element is submitted.


Note  Just as Google Tag Manager includes built-in variables for the Click listener like {{Click ID}} and {{Click URL}}, it has the same set of variables available for the Form listener. You’ll want to make sure these are enabled in the Variables section in Google Tag Manager before setting up a Form listener.



Let’s look at how to create the tag and trigger for form submission.

Create a new tag.
Choose Google Analytics ➤ Universal Analytics as the type.
Fill in the Tracking ID with the {{GA Property ID}} variable that you previously created.
Select Track Type ➤ Pageview.
Under More Settings ➤ Basic Configuration,


you’ll find a field labeled Document Path. This is the URL recorded by Google Analytics. By default, it’s just filled in with the current page path, but you can override that label here.


(This is the essence of your “virtual pageview”: you’re creating a URL that doesn’t actually exist to represent the form submission.) You can use any combination of text and variables here to construct a URL.


  • Often it makes sense to use the current page (the {{Page Path}} variable) and append some label to the end:
  • {{Page Path}}/red-queen-submitted


  • Now specify a trigger for the tag.
  • Choose Form, and then select the New button to create a new form trigger.


like a link, the form typically submits to the same browser window, replacing the current page. Choose the Wait for Tags option with the default two-second maximum to give the tracking tags time to execute before the form is submitted.


use the Check Validation option to only trigger when the form will successfully submit. Typically a form includes validation checks such as checking that the user has completed the required fields and entered values in the correct formats.


With this option enabled, the trigger will only operate when the validation is successful and the form submits. If this option is disabled, the trigger would operate each time the user clicks the submit button, whether or not validation is successful.


under “Enable when”, filter pages on which the trigger listens for the form submission. It’s only necessary for this listener to operate on a page where the form could appear. If it’s a form that appears in many places throughout the site, you can use a regular expression to match any URL:


  • {{Page URL}} – matches RegEx – .*
  • Otherwise, you can be more restrictive to include only the page or pages where this form appears.


  • Under “Fire when”, choose Some Forms and specify one or more criteria to restrict this trigger to the form you want to track. Most commonly, you might use the Form ID or Form URL variables to restrict to a specific form.


  • {{Form ID}} – equals – red-queen
  • Select the Create Trigger button, giving the trigger a name: “Red Queen Form”. Google Tag Manager saves the trigger and returns to creating the tag.


  • Save the tag, giving it a name: “GA – Pageview – Red Queen Form Submission”.
  • Now that you have a distinct URL for the form submission, you can use that URL as a goal or funnel step.


AJAX and Dynamic Processes

Google Analytics

Sometimes a multistep process may occur all within the same page, without the page reloading or the URL changing. The user interacts with the content to step through the process, and the content of the page dynamically changes, but the user is on the same page.


It’s even possible for a whole website or web application to be built as a single page, which changes content as the user “navigates” through, though the page never fully reloads or changes URLs.


This is commonly referred to as AJAX (short for Asynchronous JavaScript and XML, although the term has come to encompass a variety of related techniques that aren’t necessarily asynchronous and don’t necessarily use XML).


AJAX can be an elegant and attractive option for dynamic content, but it also introduces several challenges because of the ways it differs from a “normal” website with distinct pages and URLs.


Since the page doesn’t fully refresh, Google Tag Manager only triggers the single, initial page view. To capture further interactions, you’ll have to use other event listeners to trigger tags. There are a couple of possible options, depending on how the site is set up.


The History Listener. Most modern AJAX designs are browser- and search engine-friendly: they allow direct linking to dynamic content, and they allow the browser’s back and forward buttons to operate correctly.


They do this by several different methods of inserting entries into the browser’s history to keep track of the state and path of the user. GTM’s History Listener can be triggered by these changes.


The Click Listener. For simple situations, or where dynamic interactions are not reflected in the browser history, you can use the Click Listener to trigger a click on a particular button, link, or another element.

Both of these are described in the following sections.


Caution  If you aren’t the author of the AJAX processes on your website, make sure you speak to the developer and understand how they operate.


GTM’s listeners are pretty harmless and unlikely to interfere with the page’s functionality, but you do want to ensure that the data accurately reflects the interactions you want to capture.


The History Listener

There are two major ways that dynamic pages can use to keep track of the state of the page in the browser:

the URL fragment, or HTML5’s window.history API.


The URL fragment is the portion of the URL after the hash (#). You may be familiar with this from links within a page, to jump to a particular location within the page.


URL fragments don’t change the base URL and don’t trigger a reload of the page. Since the browser keeps track of these in its history, however, dynamic pages can use artificial labels for the URL fragment as one way to support the Back and Forward buttons.


Dynamic pages using URL fragments might have URLs that look like these:





Additionally, HTML5 introduced the window. history API, which allows dynamic pages to directly insert entries into the browser history.


The window.history.pushState() and window.history.replaceState() methods allow scripts to insert entries into the browser history, including both a JSON object that maintains the state as well as a new URL.


Additionally, the popstate event allows for monitoring any changes to the history state, including the use of the Back and Forward buttons.


To cover these, Google Tag Manager has a History Listener trigger, which allows you to trigger tags on any of the following occurrences:

  • The URL fragment changes
  • The window.history.pushState() or window.history.replaceState() methods are called A popstate event occurs


Whenever one of these occurs, a message is pushed to the data layer that looks like the following:


'event': 'Google Tag Manager.historyChange',

'Google Tag Manager.historyChangeSource': 'pushState',

'Google Tag Manager.newHistoryState': historyStateObject,

'Google Tag Manager.newUrlFragment': '',

'Google Tag Manager.oldHistoryState': null,

'Google Tag Manager.oldUrlFragment: ''


The new and old history state objects and URL fragments are included (if any), as well as the source of the history change (pushState, replaceState, or popstate).


There are several built-in variables to access these; enable those in the list of variables before using the History listener. The {{Page URL}} variable is also updated if changed by pushState or replaceState, and you can create one or more variables to access properties of the state object (if used).



Let’s look at how to create the tag and trigger in Google Tag Manager for a historic change.

  • Create a new tag. Choose Google Analytics ➤ Universal Analytics as the type.


  • Fill in the Tracking ID with the {{GA Property ID}} variable that you previously created.


  • Select Track Type ➤ Pageview.


Under More Settings ➤ Fields to Set, set the page field (the URL recorded by GA). If calls to pushState() or replaceState() change the URL, you might simply use the {{Page Path}} variable or you could use information from the state object as a virtual URL.


For changes in the anchor portion of the URL, you could use the {{New History Fragment}} in conjunction with the {{Page Path}} variable to construct a virtual URL:


{{Page Path}}#{{New History Fragment}}

  • Select the Continue button to specify a trigger for the tag.
  • Choose More to see the list of all listeners. Then choose New to create a new trigger.
  • Choose History Change as the trigger type.


You can choose to trigger on All History Changes, which might be the right option for a completely AJAX-based website. If you’re just measuring a certain page or process, you can specify some criteria to restrict this trigger.


Depending on the scenario, you might restrict the trigger to certain pages (via the {{Page URL}} variable) or to certain types of history change interactions (using the built-in history variables described above). Specify a condition that reflects the situation on your site.


  • select the Create Trigger button, giving the trigger a name: “AJAX Reservation Page”. Google Tag Manager saves the trigger and returns to creating the tag.


  • Save the tag, giving it a name: “GA – Pageview – Ticket Reservations”.

Now that you have distinct URLs for the steps in the dynamic process, you can use those URLs as a goal or funnel step.


Using the Click Listener

An alternative for dynamic content without URL changes is to use the Click listener. If the user causes a dynamic change in the page by clicking an element of the page, the Click listener can capture that interaction.


This is especially useful as a workaround for AJAX processes that don’t use URL fragments or the window. history API to properly support the Back and Forward buttons (described in the previous section).


In such a scenario, you can set up triggers on a link using criteria like the URL, id, or other properties, but instead of using a Google Analytics event tag, you’ll use the pageview tag like the examples in this blog. Remember to specify a virtual URL for the page field to identify the interaction.


Flash and Other Browser Plugins

Google Analytics flash

Interactive, dynamic content in a page may also be in an embedded object handled through a browser plugin, such as content developed using Adobe Flash.


In the browser’s DOM, such objects are a black box: their content is not accessible via JavaScript, so neither GTM’s built-in listeners nor custom JavaScript can give you detailed information about user interactions with the content of Flash.


Instead, tracking can be built into the Flash object itself, using Flash’s scripting language (ActionScript) to interface with the browser’s JavaScript.


In the past, Adobe has provided a semiofficial ActionScript library for Flash tracking in Google Analytics, although updates have not occurred in some time, and at the time of this book’s publication, it has not been updated to support GA’s newest Universal Analytics tracking.


(Microsoft Silverlight, an alternative to Flash, is in a similar situation, but Microsoft has announced the end of support for Silverlight, so it is unlikely that its Google Analytics tracking library will be updated.)


However, ActionScript in a Flash object can call JavaScript within the page containing the object, so you can push events to the data layer for Google Tag Manager from your Flash widget or application. Google Tag Manager can then trigger tags based on the data layer messages.


Conversions That Span Sessions

GA’s model of conversions includes a funnel that occurs within a single session. For some more complicated processes, it’s possible that the user might actually complete several steps in one session, and come back at a later time to finish. Here’s one common example of how that might happen in account signup or registration process:


  • The user fills out details to create their account, going through one or several pages of forms on the website (Pages A, B, C).
  • An email is sent to the email address the user registered to confirm that it’s correct.
  • The user clicks a link in the email, opening another page on the website, to confirm and finish the account registration (Page D).


You could create a single goal with a funnel all the way from Page A to Page D. However, it’s certainly possible that a user completes the steps from Page A through C, and then returns at a later time, in a new session, to Page D (after receiving the email).


A better approach might be to have two separate goals, one from Page A to Page C, and another for Page D. 


In other scenarios, you might have a long or complicated process in which a user can save their progress and return later. Or, you might be interested in whether the same user comes back twice within a week.


In such cases, you might keep track of specific behaviors or achievements with a cookie, and only trigger a pageview for your goal when some cumulative set of achievements is completed.


You can set new cookies with custom JavaScript (using the document.cookie property), and GTM’s variable types include the ability to read a value from a cookie.


Once you’ve created Google Tag Manager variables based on cookie values you’ve set, you can use them in a trigger or in the URLs of virtual pageviews. 


For tracking users across devices, which is very useful in situations where users log in and you want to tie together their behavior, regardless of the device or browser they’re using to access the site.)


You can set up goals in Google Analytics to easily allow you to make comparisons on conversion metrics. Goals can be based on URLs, events, or the number of pages or duration of a session. Goals based on destination URLs can include a funnel, which is a series of steps, also specified by URL, that lead up to the final conversion page.


For interactions where URLs don’t change, you can still set up URL-based goals using pageviews with virtual URLs. Google Tag Manager includes a Form trigger for form submissions and a History Change trigger for dynamic AJAX-based interactions, as well as the Click trigger discussed previously.


You can override the URL recorded by Google Analytics in the tag in Google Tag Manager using variables or text to generate a virtual URL label.

Google Analytics Direct Traffic 2018

Google Analytics Direct Traffic

Google Analytics provides a number of dimensions describing a session’s traffic source. Beyond the default values assigned, you can use campaign tagging and other features in Google Analytics, or override the values in GTM’s Google Analytics tag, to customize the labeling of marketing and advertising sources.


Google provides a number of integrations between sources of advertising and marketing data on Google platforms with Google Analytics and Google Tag Manager


Self-referrals are the most common issue with traffic source data and commonly result from untagged pages, poorly-behaved redirects, or incorrect subdomain or cross-domain tracking.


Google Analytics has an entire set of Acquisition reports, dedicated to categorizing users’ sources of traffic to the site. Did they come from a search engine, a link on a social media site, or a paid advertisement?


This blog will look at the data Google Analytics gathers about traffic sources and how you can influence those data with settings in Google Analytics and tools in Google Tag Manager.


what does google analytics do

what does google analytics do

In the first hit in a user’s session, Google Analytics looks at the browser’s Referrer value (the URL of the previous page) to determine where the user came from to arrive at the site.


Based on this value, it assigns values for two of the dimensions used in the Acquisition reports, Medium and Source. A medium represents a general category or type of traffic, while the source specifies a specific site within that category.


Google Analytics categorizes traffic by default into the following mediums and sources:

Organic search traffic:

Medium is organic and Source is the name of the search engine (Google, Bing, Yahoo, etc.). This is traffic that comes from a search engine site.


Referral traffic:

Medium is referral and Source is the domain of the site. This is traffic that comes from a link from another site (any site other than a search engine).


Direct traffic:

Medium is (none) and Source is direct. Direct traffic is traffic that has no other apparent source, typically because the user typed in a URL, used a bookmark, or otherwise directly used the URL. A URL opened in a web browser from an application outside the web browser would also be classified as direct.


These values can be found in the Acquisition ➤ All Traffic ➤ Source/Medium report, and throughout reports in Google Analytics.

ATTRIBUTION IN Google Analytics

ATTRIBUTION IN Google Analytics

Attribution is a term in web analytics that refers to applying a model for crediting traffic sources for desirable behavior, such as sessions or conversions.


Users often visit the site multiple times via multiple sources, so there are various ways or models you could use to credit those sources: give all the credit to the first one, or all to the last one, or divide the credit equally among all of them, as a few examples.


Google Analytics records a traffic source for each session. In all of its standard reports, Google Analytics uses what’s called “last-click attribution” to report these traffic sources, meaning that however the user got to the site this time (the last click) is the traffic source to which the session will be attributed.


However, there’s one important exception to this “last-click” rule: if a session’s traffic source is direct, Google Analytics remembers the previous traffic source and attributes the session to that. Essentially, direct never overwrites a previous traffic source.


What’s the rationale here? Recall that direct traffic is basically no information about where the user came from. So this rule says that if you know something about how they got here the last time, let’s not overwrite that with nothing.


The timeout for how long Google Analytics “remembers” the previous source for the user is adjustable; it’s six months by default. Find the setting in the Admin area in the property settings under Tracking Info ➤ Session Settings.


As noted, this “last-click except direct” rule is used in all of Google Analytics’s standard reports. However, Google Analytics also has a series of reports in Conversions ➤ Multi-Channel Funnels that can look at the source for every session over a period of time before conversion.


The Attribution Modeling Tool allows analysis under different attribution rules, such as first-click, last-click including direct, weighted credit among all traffic sources, and so forth.


Beyond the default categorization performed by Google Analytics, you can influence these classifications and supply additional detail about how you’d like to label traffic sources to better reflect your site and its audiences. Let’s see how.


Adding Organic Search Engines

Google Analytics recognizes a wide list of organic search engines by default,1 but if a particular search engine is not in that list, you can add domains to be counted as search engines (rather than referrals).


This is typically used for the following situations: Language- or country-specific search engines relevant to your site not included in Google Analytics’s default list. Industry-specific or other niche search engines relevant to your site. 


You can add search engines by specifying domains and URL patterns for search results pages in Google Analytics’s Admin area in the property settings under Tracking Info ➤ Organic Search Sources.


When added to this list, referrals from the site will be categorized as organic rather than referrals, just like organic search traffic from other search engines.


Ignoring Certain Referrers

Google Analytics also gives you the option to ignore certain referring sites (treating them as direct). This is most common in the following situations:


Certain types of third-party sites, such as PayPal. It’s typical for a user to leave your site, go to PayPal (to complete a transaction), and then return to your site for the final confirmation message. You’re not interested in counting the return as a referral from PayPal.


Cross-domain tracking

You can specify domains to treat as direct in Google Analytics’s Admin area in the property settings under Tracking Info ➤ Referral Exclusion List. Any referrals from sites added to this list will be treated as direct traffic.


Campaign Tracking

Campaign Tracking

For links to your site that you control, you can specify exactly the value you’d like Google Analytics to use for the medium and source (as well as additional traffic source dimensions). This could include many types of marketing and advertising links:

  • Paid search and display advertisements
  • Social posts and paid social advertisements
  • Links in email marketing, such as a newsletter or promotion
  • Links from partner or affiliate sites
  • Links to offline advertising, such as print, TV, or radio


Note  Google Analytics can only measure activity on your website and how users arrived there. It’s not a tool for measuring activity on other sites, such as how many people liked or shared a link on a social network. Other tools can be used to gather those types of data.


It’s useful to be able to specify your own labels for these types of traffic since you’ll want to break them out from referral, organic, and direct traffic and be able to analyze their effectiveness. You can specify your own values for a variety of traffic source dimensions:

  • Medium: The general category of the type of traffic. Values such as email, social, display, print, and so forth, are common.


  • SourceWhere specifically within a medium the traffic came from. Often this is the domain of another website, such as a social network or a site where a display ad was shown. For an email, it might be the name of the list the email was sent to; for print, it might be the name of the publication.


  • Campaign: A specific promotion or marketing activity. For example, you might promote the Spring Season Ticket Sale across many mediums and sources. You want to be able to bring all of that traffic together under a single campaign.


  • Keyword (optional): A keyword used in search advertising.


  • Ad Content (optional): A label describing the content or format of the ad. For example, you might use this to distinguish several different display ads with different creative content or to differentiate between different sizes and formats for the ad.

The Acquisition reports allow you to view traffic using any combination of these dimensions.


Campaign Tracking URLs

Campaign Tracking URLs

So how do you provide the values you’d like to use for these traffic source dimensions to Google Analytics?


You can specify the values you’d like to use for these dimensions using campaign tracking URLs, or what’s commonly called campaign tagging for Google Analytics. (Don’t be fooled by the word “tag”; these are unrelated to tags in Google Tag Manager.)

There are specific query parameters you can include in a URL to specify values for these traffic source dimensions. 


This would be a URL for a landing page you would use in a promotional email (the medium) about the Spring Ticket Sale (campaign) you sent to users on the Mad Hatter’s Club mailing list (source). Notice the query parameters begin with utm_ and correspond (in this case) to the Medium, Source, and Campaign dimensions.


Like all query parameters, the start of the query string is signaled with a question mark (?), each parameter is a key-value pair separated by an equals sign (=), and each parameter is separated by an ampersand (&).


There are five parameters recognized by Google Analytics corresponding to the dimensions listed earlier: utm_medium, utm_source, utm_campaign, utm_term, and utm_content. The Source, Medium, and Campaign are required (or at least, very strongly recommended; the only Source is technically required), while the Keyword and Content are optional.


Note that the values provided are URL-encoded (so that a space character appears as %20, for example).

This tool is handy, but it’s important to note that using it is not required. As long as you provide the parameters in the correct format when someone clicks this link and arrives at the website, Google Analytics will recognize the values and use them for the traffic source dimensions (rather than whatever would have been recorded by default).


Note that there’s nothing you have to do to set up Google Analytics beforehand (telling it a list of the source, medium, and campaign values, for example), and anyone can create one of these URLs (they don’t need to be an administrator in Google Analytics).


This creates a very flexible system that empowers everyone in the marketing department to label the marketing and advertising links they’re responsible for, but it also means that there’s a potential for inconsistency.


Whatever values are in the URL parameters will be exactly what appears in Google Analytics. It’s important that capitalization, spelling, and formatting are consistent among the parameters used—for example, email, Email, and e-mail will all show as separate values in Google Analytics. Filters on views can be used to clean up accidents with campaign URLs, but consistency should be your first objective.


The most important planning that you can do for campaign tracking URLs is to define some standard for your organization and how you label your advertising and marketing and make sure that everyone adheres to those standards. There are a number of technical measures that can help you achieve consistency:


Google advertising platforms AdWords and DoubleClick have automatic integrations with Google Analytics (described later in the blog), so you don’t need to worry about manually applying campaign parameters.


Many third-party tools have integrations with Google Analytics that can automatically tag URLs. For example, MailChimp, a popular email marketing system, can automatically add campaign parameters to links in email campaigns.


Instead of the URL builder form in Google Analytics, you can use a shared spreadsheet (like a Google Sheet) or a web form with some drop-down choices to enforce consistency in the values marketers choose when they create campaign URLs.


Shortening Campaign URLs

Campaign URLs can be long, which is fine if you’re using them as the destination URL for an advertisement or in an email. But in a social media post or print, where brevity or readability is important, using a URL shortener can be useful.


It’s fine to use a URL shortener (such as, the most popular option) with campaign-tagged links from Google Analytics. Simply add the campaign parameters first, then enter the campaign-tagged URL as your link to be shortened.


You can also use so-called “vanity URLs” as shortened versions of campaign URLs, by simply using a redirect from a short URL like this:

To a full, campaign-tagged URL:

Vanity URLs are especially useful for a print or other offline advertisement or marketing material where you’d like to include a branded link.


Of course, there’s no guarantee that people who saw the ad will necessarily use the URL (rather than just visiting directly or using a search engine), but it gives you some indication of the relative response of different offline ads used to drive traffic to your website.


Avoiding Conflicts with Campaign URLs

Avoiding Conflicts with Campaign URLs

As you saw earlier, you can specify traffic source dimensions by including parameters in the query string in links to your site. In most cases, a website will simply ignore query parameters it doesn’t recognize (such as the utm_ parameters).


With some content management systems or web servers, however, unrecognized parameters may cause issues or be disallowed. Specifically, you should ensure that your website is prepared to handle the following query parameters:

  • utm_source, utm_medium, utm_campaign, utm_term, utm_content
  • utm_id
  • gclid, dclid (described next in the sections on integrations with other Google tools)

Your website should not cause redirects that strip away these parameters.


If for some reason, you need to avoid using query parameters, Google Analytics does provide an alternative. Instead of the URL’s query string, you can use the fragment or anchor string portion of the URL (the portion after the #) to include campaign information.


Because this part of the URL is used by the browser and not typically interpreted by the server, it’s “safe” for situations where your web server or content management system prevent you from using Google Analytics’s campaign tracking query parameters in URLs. 


The format for the campaign tracking information is the same, but is in the URL fragment (note the #):

  • #utm_medium=email
  • &utm_source=Mad%20Hatter%27s%20Club
  • &utm_campaign=Spring%20Season%20Ticket%20Sale


To enable this in Google Analytics, there’s a setting called allow Anchor in the tracking code. In the Google Analytics pageview tags in Google Tag Manager, you can set this value in the Fields to Set section when editing the tag. Setting this value to true allows you to use the campaign labels in the URL fragment.


Specifying Campaign Values with Google Tag Manager

Specifying Campaign Values with Google Tag Manager

Sometimes rather than specifying campaign values in a link, using the URL parameters described earlier, you’d like to specify campaign parameters based on the page or pages of your website. This is most commonly used for the following:


Adapting legacy tracking URLs to Google Analytics: In some cases, you may have a system of labeling campaign URLs that predates your use of Google Analytics.


You might use a particular URL pattern or query parameter that you’d like to translate into the appropriate campaign dimensions in Google Analytics.


Links “in the wild” with missing or incorrect campaign tagsEven with the best efforts at being assiduous and consistent in applying campaign tracking parameters to URLs, sometimes mistakes happen.


You can supply values for campaign dimensions based on a landing page or referrer in such cases. Whatever the reason, you can use Google Tag Manager to override the campaign dimension values.


Campaign values in a Google Analytics tag in Google Tag Manager

Let’s look at how to override campaign values in a Google Analytics tag in Google Tag Manager. In Google Tag Manager, in the Tags section, choose a Google Analytics pageview tag and select it to edit.


Caution  Typically you would not make this change to the pageview tag on all pages. You’ll probably only want to do this for a particular circumstance defined by a trigger (such as on a particular landing page URL or for a particular referrer) or based on a variable value (such as a query parameter in a URL).


  • Click on Configure Tag to make changes to the tag configuration.
  • In More Settings ➤ Fields to Set, enter the following:
  • For the Field Name, choose one of the following options, depending on which field you’d like to set: campaignMedium, campaign source, campaignName, campaign keyword, campaign content, or campaigned.
  • For the Value, enter a fixed value or a Google Tag Manager variable with the value you’d like to use.


Tip   Variables based on the page or referrer URLs (or portions thereof) are useful for dynamically creating values.

  • Repeat step 3 for each additional campaign value you’d like to set.
  • Select Save Tag to save the changes to the tag.


Once published, Google Tag Manager will now override the default traffic source dimension values with the values specified in the tag.


Channel Groupings in Google Analytics

Specifying Campaign Values with Google Tag Manager

You’ve seen that there are a number of traffic source dimensions in Google Analytics, including source, medium, campaign, and others. Additionally, Google Analytics allows you to group combinations of those dimensions into channel groupings.


The channel groupings are a way of categorizing the traffic sources into channels that correspond to the way that you think about your marketing and advertising activities. 


Google Analytics provides a default set of channel groupings (which you can find in the Acquisition ➤ All Traffic ➤ Channels report), but you’re able to customize them to best fit your circumstances.


The default channel groupings include the following channels:

Direct: Direct traffic, with Source value of direct and Medium of (none) or (not set).

Or Google Analyticsnic: Organic traffic from search engines, with Medium of or Google Analytics


Social: Referral traffic from social media sites, with Medium of referral and Source matching a list of social media sites recognized by Google Analytics, or with Medium containing social, social-network, social-media, sm, social network, or social media.


ReferralReferral traffic from all other (non–social media sites), with Medium of referral.

Email: Traffic from email, with Medium of email.


Paid Search: Paid traffic from search engines, with Medium of CPC, PPC, or paid search, but not with Ad Distribution Network of Content. (See the AdWords integration description for additional information on AdWords-specific dimensions like Ad Distribution Network.)


Display: Display advertising, with Medium of the display, CPM, or banner, or with Ad Distribution Network of Content.

Other AdvertisingMedium of CPV, CPA, cpp, or content-text.

Anything that doesn’t fit into one of these categories is labeled (Other).


As you can see, using these channel groupings can help sort out different categories of traffic, such as pulling out referral traffic from social media sites and putting that together with campaign-tagged links from social media (thus grouping together what’s commonly termed your “earned” and “owned” social traffic).


However, the default categories may not be sufficient to reflect the types of marketing and advertising you do. Examples might include the following:

  • Dividing the Paid Search channel into branded and generic keywords.
  • Dividing Display into topic-based advertising vs. remarketing.
  • Creating a channel for Partner or Affiliate links.


Google Analytics allows you to alter the default channel groupings or create entirely new groupings in the Admin area. You can find these settings in the View settings (third column) under the Channel Settings ➤ Channel Grouping. Each channel grouping is based on a set of rules.


The rules are applied in the order they appear in the channel grouping settings, and the first rule that matches a session is the label that is applied. Any sessions that don’t match any of the rules in the channel grouping displays the value (Other).


Changes to the default channel grouping are applied to all data collected going forward and do not retroactively change historical data. New channel groupings can be applied at will in reports (much like a segment) to view historical data (but may trigger sampling when applied).


Traffic Data Integrations

Traffic Data Integrations

Google provides a number of integrations between Google Analytics and other Google platforms for data about traffic sources.


These integrations can import a number of dimensions and metrics into Google Analytics to enrich the interaction data with information such as impressions, click-through rates, and cost.


And don’t forget, Google Tag Manager is useful for tags other than Google Analytics tags as well—including tracking and conversion tags for advertising and marketing tools.


Google Tag Manager provides built-in tag types for Google platforms such as AdWords conversion and remarketing tags, DoubleClick Floodlight tags, and Adometry tags, as well as tags for third-party tools.


Additionally, Google Tag Manager offers an integration with DoubleClick Campaign Manager to manage the workflow of creating Floodlight tags.

In the following sections, you’ll take a look at the integrations between Google Analytics and Google Tag Manager and Google platforms and tools.




Google Analytics integrates with AdWords, Google’s advertising platform for ads on search results and on its display network. Linking your Google Analytics and AdWords accounts enable a number of features:


Auto-tagging of AdWords destination URLs. Rather than having to manually label campaign URLs as described earlier in the blog, AdWords can automatically apply a query parameter (gclid) that identifies the ad. 


Google Analytics then imports the traffic source dimension data from AdWords, with Medium CPC, Source Google, and the Campaign, Keyword, and Ad Content corresponding to the campaign, bid keyword, and ad headline in AdWords.


Additionally, a number of AdWords-specific dimensions are imported, including Ad Group (to group together ads and keyword within a campaign), Matched Search Query (the query that triggered the ad based on the bidding keyword), Ad Slot, Placement Domain (for display network placements), and others.


Importing AdWords metrics into Google Analytics reportsGoogle Analytics includes a section of AdWords reports under Acquisition that import metrics such as Impressions, Clicks, CTR (click-through rate), Cost, and CPC (cost-per-click).


Combined with conversion and revenue data in Google Analytics, these can be used to calculate ROAS (return on ad spend) or CPA (cost per acquisition).


Having the cost data (from AdWords) and the response data (from Google Analytics) in a single set of reports creates a very valuable tool to evaluate the cost-effectiveness of advertising.


Importing Google Analytics metrics into AdWords reportsGoogle Analytics metrics such as Bounce Rate can be used in reporting within AdWords, and Google Analytics goals and e-commerce transactions can be imported to AdWords as conversion data.


Creating remarketing audiences in AdWords from Google Analytics segments. All of the behavioral data in Google Analytics can be used to create audiences for remarketing (showing ads to users who have visited the site before or completed a specific action). 


Google Analytics’s detailed segmentation tools allow you to tailor specific audience behavior you’d like to target. AdWords audiences can be created in the Admin area in the property settings, or directly from an existing segment in the segmentation drop-down in reports.


To Google Analytics in all of these advantages, you need to link your AdWords and Google Analytics accounts together. Linking is between an account in AdWords and a property in Google Analytics.


Since there are many possible configurations of sites and how they correspond to Google Analytics properties and AdWords accounts, multiple AdWords accounts can be linked to a single Google Analytics property, and multiple Google Analytics properties can be linked to a single AdWords account, as needed.


Tip  Linking an AdWords account to a property will import AdWords metrics (Clicks, Cost, Impressions, etc.) for all of the campaigns in the AdWords account, potentially including campaigns or ad groups that have ads for other sites.


It’s a good idea to try to orGoogle Analyticsnize your AdWords and Google Analytics accounts in a similar fashion, with one AdWords account per site (Google Analytics property). Even though it’s not strictly necessary, it makes it easier to understand how advertising and sites match up.



Linking AdWords and Google Analytics accounts requires a login that is an Administrator on the AdWords account and has Edit privileges on the Google Analytics property to be linked.


Ensure that you have the appropriate permissions in both tools before proceeding. (Once linked, anyone with Report & Analyze access to a view in Google Analytics can see the imported data, but the linking process requires Edit access.)


In the Google Analytics Admin area, with the appropriate account and property selected, choose AdWords Linking in the middle column. Select the New button to add a new AdWords link.

Select one or more of the AdWords accounts you can access to be linked to the property. Then select the Continue button.


Give the link group a title to identify it.

Select which views within the property you would like to link. You can select one or more views.


The selected views will be enabled for the integration options discussed previously, while unselected views will not contain any of the detailed AdWords data. (You can update these settings later to enable or disable a view after a link has been established.)


Note  Creating the link enables auto-tagging in the AdWords account by default. You can override this if desired, but using auto-tagging is recommended to Google Analytics in all the benefits of the AdWords integration with Google Analytics.


  • Select the Link Accounts button to complete the link.
  • Like other changes in Google Analytics’s Admin settings, this data is only imported from the time the link is established going forward.


On the flipside of the advertising coin, Google Analytics also provides an integration with AdSense—that is, for publishing ads from AdWords on your site (for which you get a share of the click revenue from Google).


Like AdWords, you can link an AdSense account to Google Analytics (in the Admin area in the property settings). Additional reports are available in Behavior ➤ Publisher and additional dimensions and metrics are available from the imported data.


DoubleClick Platforms

DoubleClick Platforms

Like with AdWords, there is also an integration with Google’s DoubleClick advertising tools DoubleClick Campaign Manager and DoubleClick Bid Manager.


These integrations are available only for Google Analytics Premium subscribers. Similar to the AdWords integration, DoubleClick supports auto-tagging (using a decline parameter), importing data into DoubleClick reports in the Acquisition section, and creating remarketing audiences for DoubleClick from Google Analytics segments.


DoubleClick Campaign Manager also integrates with Google Tag Manager, allowing DoubleClick Floodlight tags to be generated in the DCM interface and pushed to Google Tag Manager for approval.


You’ll find these in the container settings under Approval Queue. Of course, just like any other change to a container, the container must be published in Google Tag Manager before taking effect.


On the ad publishing side, Google Analytics Premium users also enjoy integration with DoubleClick for Publishers, which provides similar reports and metrics to the AdSense integration.


Google Search Console

For organic search, Google Search Console (formerly Google Webmaster Tools) provides a multitude of information about how Google’s search engine interacts with your site.


This includes metrics about search results pages where your site appeared, the keywords and landing pages that were listed, their average rank, and the approximate impressions and clicks.


A site in GSC can be linked to a property in Google Analytics (in the Admin area in the property settings) to import this information into Google Analytics. The imported data is available in the reports under Acquisition ➤ Search Engine Optimization.


Note that, unlike the AdWords and DoubleClick integrations, the GSC integration does not join external data with session data in Google Analytics. It simply makes reports from GSC available in Google Analytics’s interface as a convenience, saving you from having to log into GSC and view them separately.


Troubleshooting Traffic Sources

Troubleshooting Traffic Sources

Sometimes, traffic source information can go missing. Let’s examine the causes of incorrect traffic source data and see how you can avoid pitfalls.



Redirects are a valuable tool to enforce consistency in URLs on a website, to provide alternative (usually shorter) URLs, and to ensure that historical links continue to work.


However, you need to be a little careful about how redirects are used on your site to ensure that you don’t lose data about how a user arrived at the site. You need redirects to do both of the following:


The redirect preserves the HTTP Referrer header. The Referrer header tells the browser what URL was the previous page when a link is followed and is the signal Google Analytics uses to assign the source in referral and organic search traffic. Server-side redirects (also called 301 or 302 redirects) typically preserve the Referrer header.


The redirect preserves any query parameters in place on the original URL—specifically any of the campaign tracking parameters described earlier in the blog. These parameters should be visible in the URL in the final destination page—if you can’t see them in the URL, Google Analytics doesn’t see them either.


You can check for the appropriate behavior using your browser’s testing tools on a redirected URL. For example, suppose I know that gets redirected to (without the www).


I can test a link from a referring site to see the type of redirect and that the Referrer header is preserved, and I can test a campaign-tagged link to ensure the campaign parameters are preserved. Here’s how.


First, I followed a link from another site to the link (with the www). Looking at the Network tab in Chrome’s developer tools


Notice that the status code returned by the server is 301 Moved Permanently (a permanent, server-side redirect), and looking at the request headers you see that the Referrer header appears both in the original request and in the redirected URL.


If this is not the case (i.e., if you don’t see either 301 or 302 as the status code), the redirect is a client-side redirect, meaning it happens in the browser itself, rather than on the web server.


The effect of this will be that two pages will load in direct succession—first the redirect page, then the actual destination page. Depending on the setup in Google Tag Manager, you’ll have one of two problems:


You’ll have two pageviews in direct succession without any interaction by the user, causing the bounce rate to go to 0% for traffic using the redirect URL.


You’ll have an untracked pageview on the redirect page, meaning the original source information is lost and you’ll see a self-referral (see the upcoming section).


Obviously, neither of these is an ideal situation—you’re losing one type of data or the other. This is why client-side redirects are not recommended; switch to using a server-side redirect instead. (How you’ll go about this will depend on your web server or content management system; consult the appropriate documentation.)


Note  There are workarounds for using client-side redirects with Google Analytics to capture and then provide the original referrer, either through a cookie or a query parameter value.


However, client-side redirects are generally harmful to search engine optimization as well, so the best advice is to avoid them entirely in favor of server-side redirects.


Now let’s try a campaign link with a redirected URL

Here you can see the campaign parameters are included both in the original request and in the URL after the redirect. Success!


A Google Analytics in, if this is not what you see, you’ll need to look at the settings for your web server or content management system to see if there’s a way to alter this behavior to preserve these parameters.


(Alternatively, you might also be able to use the setAllowAnchor setting described earlier in the blog to use the URL fragment rather than the query string to transmit campaign tracking information.)



One of the most common traffic source problems in Google Analytics is seeing self-referrals: your own website appears as a referral source. Obviously, this isn’t intended—when a user follows a link from one page on your website to another page, that shouldn’t count as a referral—it’s just naviGoogle Analyticsting through the website!

Why do self-referrals happen? The two most common reasons are untagged pages and incorrect cross-domain or subdomain tracking.


Untagged Pages

When a user lands on a page and begins a session, Google Analytics assigns the source, medium, and other traffic source dimensions discussed earlier in the blog. However, suppose you have a situation where the user lands on a page where no Google Analytics tag fires. What happens?


Since no Google Analytics tag fired, no session has yet begun. If the user continues to navigate to a second page—this one with a Google Analytics tag—Google Analytics begins a session and says, “OK, where did this user come from?”


In this case, it’s from another page on your site, and Google Analytics assigns the medium “referral” and the source as your own domain.


In the Acquisition ➤ Traffic Sources ➤ Referrals report, you can drill down into self-referrals to see the pages they originate from. Check the following things on those pages:


Is the Google Tag Manager container on the page? Use the Google Tag Assistant extension or check the page’s source code to confirm. Sometimes certain pages might use a different template or layout and you accidentally missed including the container code.


Is there a Google Analytics tag set to be triggered on the pageview (gtm.js event) for this page? Use GTM’s debug mode to look at the tags and which ones trigger on this page.


If no Google Analytics pageview tag is triggered, you need to alter the triggers in Google Tag Manager to make sure you’re tracking this page.


Incorrect Cross-Domain or Subdomain Tracking

Google Analytics uses cookies to keep track of users. When there are multiple domains or subdomains that you’d like to measure as a single site, you need to ensure that Google Analytics has consistent cookie values across these domains.


If it doesn’t, it will treat each site as separate, with a separate session on each, and you’ll see referrals between those domains.


If you have multiple domains or subdomains and you’re seeing referrals between them, incorrect settings in the Google Analytics tags in Google Tag Manager are the likely culprit.


You need to ensure that all Google Analytics tags in Google Tag Manager include the appropriate cross-domain settings. Check your tag setup carefully and make the necessary adjustments.


Measuring Campaigns and Troubleshooting Traffic Sources

Google Analytics provides a number of dimensions describing a session’s traffic source. Beyond the default values assigned, you can use campaign tagging and other features in Google Analytics, or override the values in GTM’s Google Analytics tag, to customize the labeling of marketing and advertising sources.


Google provides a number of integrations between sources of advertising and marketing data on Google platforms with Google Analytics and Google Tag Manager. 


Self-referrals are the most common issue with traffic source data and commonly result from untagged pages, poorly-behaved redirects, or incorrect subdomain or cross-domain tracking.


Google Analytics has an entire set of Acquisition reports, dedicated to categorizing users’ sources of traffic to the site. Did they come from a search engine, a link on a social media site, or a paid advertisement?


This blog will look at the data Google Analytics gathers about traffic sources and how you can influence those data with settings in Google Analytics and tools in Google Tag Manager.