Beginners Guide to Universal Analytics – Creating Custom Dimensions & Metrics


Universal Analytics (UA) is going to change the way we look at the data for good. One year from now, our analytics reports will be unrecognizable.

I have been using UA for a while now and would like to share some quick tips to get you started. The first thing that you need to understand is the difference between universal Analytics and Google Analytics.


Difference between Universal Analytics and Google Analytics

  1. Data Collection and integration
  2. Data Processing
  3. Custom Dimensions and metrics
  4. Custom variables
  5. User Interface
  6. Javascript library
  7. Tracking Code
  8. Technical Knowledge
  9. Referrals Processing
  10. Cookies
  11. Privacy and data usage

Data Collection and Integration

  • Universal Analytics (UA) provides more ways to collect and integrate different types of data than Google Analytics (GA).
  • Through UA you can integrate data across multiple devices and platforms. This is something which is not possible with GA.
  • Consequently UA provides better understanding of relationship between online and offline marketing channels that drive sales and conversions than GA.

Data processing

  • The date processing in UA is visitor based instead of visit based.
  • Consequently UA is more visitor centric than visit centric.

Custom Dimensions and Metrics

  • In UA you can create and use your own dimensions and metrics to collect the type of data GA does not automatically collect (like phone call data, CRM data etc).
  • These user defined dimensions and metrics are known as ‘custom dimensions’ and ‘custom metrics’.
  • Through custom dimensions you can import additional data into your analytics account.
  • GA does not allow you to define your own dimensions and metrics.

Custom Variables

  • UA uses custom dimensions instead of custom variables
  • GA uses custom variables instead of custom dimensions.
  • Though ‘custom dimensions’ are not available in GA, custom variables are still available in UA (although not sure for how long)

User Interface

  • Interface wise both UA and GA reports look the same.
  • The difference is in how each collect, integrate and process the data.
  • There are not any new reports in UA yet.
  • However once you start using custom dimensions and custom metrics, your UA reports may look very different from your GA reports.

JavaScript Library

  • UA uses ‘analytics.js’ JavaScript library whereas GA uses ‘ga.js’ JavaScript library.
  • The ‘analytic.js’ library is similar to ‘ga.js’ library but provides new set of features for collecting and integrating data.

Tracking Code 

UA uses different tracking code than GA:



Technical Knowledge

To use all the features of UA you need good technical knowledge of your development environment/ platform or you should know someone who has such knowledge.

Otherwise you may have a hard time using custom dimensions, custom metrics and integrating data across multiple devices/ platforms.

Without this technical knowledge, UA is not very useful  for you. This is not really the case with GA.

Note: UA does not support ‘Re-marketing’ yet.


Referrals Processing

In UA referrals are processed differently.

By default all referrals trigger a new web session in UA. This can affect the number of web sessions in your analytics reports.

For example: let us suppose a visitor arrived on the website from then returned back to

When the visitor arrived on the website from, it will trigger a new web session.

When the visitor returned back to from, it will trigger another new web session. So in total 2 web sessions will be triggered in UA:


If you do not want the new web session to be triggered when the visitor returned to from then you need to exclude referrals from



Cookie is a text file which is used to store information about a visitor, his preferences, location and other details.

While GA can use up to 4 cookies (_utma,_utmb,_utmz and _utmv) to collect visitors’ usage data, UA uses only 1 cookie (called _ga).


Privacy and Data usage

Google warns against collecting any personally identifiable data in your UA accounts. Google can terminate your analytics account if you breach this policy.

You need to give your end users proper notice and get consent about what data you will collect via UA. You also need to give your end users the opportunity to ‘opt out’ from being tracked.

That means you need to make changes in your privacy and data usage policies. Google recommends using Google Analytics opt out browser add on if you want to block Google Analytics.

Note: You can learn more about the UA usage guidelines from here and about the privacy from here.


Server Side Configuration features in Universal Analytics

UA lets you change following server side configuration features via the account admin panel:

  1. Add/delete search engines
  2. Change session and campaigns timeout settings.
  3. Add/delete referral traffic sources
  4. Exclude search terms


In case of GA you need to add special tracking codes to all the web page on your website to change each of the aforesaid server side configurations.

UA has simplified changing these server configurations by providing easy to use controls in the account ‘admin panel’ which don’t require editing the existing tracking code on every web page of your website.


The Measurement Protocol

UA uses a new measurement protocol (a protocol is a set of rules) which let you send data from any device/system/environment (including smartphones, tablets, call center data, digital appliances, point of purchase systems or any online or offline customer contact point) to your Google Analytics account provided you have formatted your data according to the protocol.

Through this protocol you can import offline conversion data into GA.

The measurement protocol includes a new JavaScript library called ‘analytics.js’. Just like GA, Universal Analytics tracking code also request an invisible file called ‘_utm.gif’ each time a web page is loaded into the browser to send tracking data to the analytics server.

This GIF request is pretty long and looks something like this:


To learn more about the Measurement Protocol, please check out the post: Understanding Universal Analytics Measurement Protocol


Setting up Universal Analytics

Follow the steps below to set up your Universal Analytics account:

Step-1: Get administrative access to your Google Analytics account.

Step-2: Go to ‘Admin’ area and then from the property drop down menu, select ‘create new property’. This will create a new ‘web property’ in your existing Google Analytics account.

 Step-3: Select ‘universal analytics’ in the ‘select a tracking method’ section as shown below:


 Enter your website name, website URL. Select your industry and reporting time zone as shown below:


 Once you have completed the form click on the ‘Get Tracking ID’ button.

Step-4: The UA tracking code will now appear in a box. Copy-paste this tracking code in the head section (<head>….</head>) of every web page on your website. Remember this tracking code is different from the standard GA tracking code.

Note: If you want to use Universal Analytics for your existing website then copy-paste the new universal analytics tracking code next to your standard Google Analytics tracking code like this:


According to Google, you can use both of the tracking codes on the same web page and this will not cause any tracking issues.

However I noticed that the Google Page Speed Score went down by 1 point when I implemented both GA and UA tracking codes. Website speed is something you need to keep in mind if you opt for double tracking.

Note: If you are using both UA and GA tracking codes then you can’t enable Google Webmaster Tools data in your UA account without losing access to the Google Webmaster Tools data in your GA account. This is because only one web property at a time can be linked to a website in your Google Webmaster Tools account.

Step-5: Check the source code of the home page and other web pages on your site and look for ‘analytics.js’. If you can see this JavaScript library in your HTML code then the website is using the UA tracking code.

Also check your real time reports to make sure that you are getting data into your Universal Analytics reports.

Step-6: Change server side configuration options via your Admin panel.

Step-7: Set up custom dimensions and custom metrics.


Check out this short video on how to get started with Universal Analytics:


Change session and campaigns timeout settings

Go to the ‘Admin’ panel of your account and then click on Tracking Info > Session Settings:


By default both GA and UA ends a web session after 30 minutes of inactivity on a website or when the browser window is closed.

By default the attribution to a marketing campaign expires (timeout) after 6 months from the last time your visitor visited the site. There are certain situations in which you may need to change the time when a web session or a marketing campaings ends.

For example:

1. If your website automatically logs out a visitor say after 2 minutes of inactivity (common in case of bank websites) or if visitors spend 5 minutes on an average on your website  then it doesn’t make any sense to end a web session after 30 minutes of inactivity.

May be a session timeout of 5 minutes will be better in this case. Choose a session timeout which matches to the average time spent on your website/web pages (verify this trend over a long period of time: 3 or more months).

Note: Your web session can not be less than 1 minute or greater than 4 hours.

2. Majority of marketing campaigns become irrelevant for conversion attribution after few weeks. So it doesn’t make any sense to set campaign timeout to 6 months.

Choose a campaign timeout which matches to the time you think your campaigns will remain relevant for attributing conversions.

Note: Your campaign timeout can not be greater than 24 months (2 years)

If you want to change session timeout in GA (instead of Universal Analytics) then you need to call the _setSessionCookieTimeout() method from your Google Analytics Tracking code.

To change Campaign timeout in GA use _setCampaignCookieTimeout() method. Following is an example of how you can call these methods in your Google Analytics Tracking Code:



Customize Organic Search Sources

Google Analytics treats traffic from search engines not in the default search engine list as referral traffic.

So if you know a search engine (or may be your internal site search engine) which is not in this default list and you want Google to treat the traffic coming from it as ‘organic search traffic’ instead of ‘referral traffic’ then you need to add your search engine to the default list of search engines.

You can do this by going to the ‘Admin’ panel of your account and then clicking on Tracking Info > Organic Search Sources



Here I have added a search engine called ‘Duck Duck Go’ because it is not in the Google default search engine list. Now Google will treat all the traffic coming from as organic search traffic instead of referral traffic.

Once you have filled out your form in a similar manner and clicked on the ‘save’ button. You can then see your search engine added to the default list:


You can click on ‘edit’ or ‘delete’ link to edit or delete your search engines. You can also change the order of search engines in the list by dragging and dropping the order of each row.

When you change the order of search engines in the list, it can affect how the data appears in your reports.

For example if you list first and second and both websites use the same query parameter say ‘s’ then all the searches that happened on will be attributed to To change this attribution behavior you need to reorder the list in a way that appears first in the list.

If you want to add search engines in Google Analytics (instead of Universal Analytics) then you need to call the _addOrganic() method in your Google Analytics Tracking Code (GATC):



Excluding Domains from your referral traffic

If you want to exclude certain domains from being labeled as referrer in your analytics reports then you can do this by going to the ‘Admin’ panel of your account and then clicking on Tracking Info > Referral Exclusion List



Here I am excluding my own domain name from appearing as a referrer domain in analytics reports.

If you want to exclude certain domains from appearing as referrers in Google Analytics reports (instead of Universal Analytics reports) then you need to call the _addIgnoredRef() method in Google Analytics Tracking Code of all the web pages on your website:



 Excluding Search terms from organic search traffic

If you want to exclude certain search terms from appearing in your organic search reports then you can do this by going to the ‘Admin’ panel of your account and then clicking on Tracking Info > Search Term Exclusion List



 Here I am excluding my own domain name from appearing as organic keyword in my organic search reports. Once this search term is excluded any traffic that comes from ‘seotakeaways’ search term will be treated as direct traffic by Google.

If you want to exclude certain search terms from appearing in your organic search reports in Google Analytics reports (instead of Universal Analytics reports) then you need to call the _addIgnoredOrganic() method in Google Analytics Tracking Code of all the web pages on your website:



Understanding Dimensions and Metrics

Before we move ahead with custom dimensions and custom metrics, let us do a quick revision of dimensions and metrics. This will ensure that we all are on the same page.

A dimension is a characteristic of your visitor.

For e.g. for a visitor from London who arrived on my website via organic search term say ‘seotakeaways’ on, the dimensions are ‘city’, ‘country’, ‘keyword’, source/medium etc. These dimensions characterize the visitor (i.e. the visitor is from London, England who searched for ‘seotakeaways’ via and this is how Google Analytics reports about a visitor to my site.

A dimension corresponds to a row in your analytics report. Through dimensions you can break down a metric by a particular value like city, country, keyword, source/medium etc. Custom dimensions are user defined dimensions. It means they are defined by people like you and me. UA provides 20 custom dimensions.

A metric on the other hand is simply a number and it corresponds to a column in your analytics reports. Visits, Conversions, Revenue, pageviews, bounce rate etc. are example of metrics. Custom metrics are user defined metrics. It means they are defined by people like you and me. UA provides 20 custom metrics.

Custom dimensions and custom metrics are available in UA custom reports and as a secondary dimension in standard UA reports. They can also be used in advanced segments.

Note: GA provides more than 200 predefined dimensions and metrics.


Setting up Custom Dimensions & Custom Metrics

Before I set up custom dimensions and metrics, I create a layout of my future report. This layout is a blue print of what my report should look like:


From this layout I know that ‘Phone Call Keywords’ should be my custom dimension. Whereas ‘phone calls’, ‘admissions’, ‘call cost’ and ‘call duration’ should be my custom metrics.

Just to give you a context, I want to integrate the call center data with UA reports. My client runs a rehab center. His macro conversion is getting an admission to his center. His micro conversion is getting a phone call.  Therefore all conversions happen offline via phone calls.  Here e-commerce tracking is absolutely useless for me because no transaction is carried out online. Therefore it is absolutely critical for me to track these offline conversions via my UA reports and integrate them with predefined dimensions and metrics to get complete picture of the marketing campaigns.

The data in the table above would come from a call tracking software predominantly used by call center staff. I am planning to import this data into my UA reports via custom dimension and custom metrics.

Phone call keyword – this is the keyword which resulted in a phone call.

Phone Calls – this is the number of phone calls generated by a keyword.

Admissions – this is the number of people who admit to my client’s rehab center.

Call Cost – average cost of a phone call to the client.

Call Duration – as the name suggest, it is the average duration of a phone call.


Follow the steps below to create your first custom dimension:

Step-1: Go to the Admin panel of your UA account.

Step-2: Click on ‘Custom Definitions’ tab and then on ‘New Custom Dimension’ button:


Step-3: Enter the name of your new custom dimension, select its scope and then click on the ‘create’ button as shown below:


Every custom dimension has got three scopes: Hit, Sessions and User. When a custom dimension has hit level scope, its value is only applied to the hit with which the value was sent.

Note: Hit is a call to the GA/UA server by different libraries (like ga.js, analytics.js, urchin.js etc). A hit can be a pageview, event, transactions or item.

When a custom dimension has Session level scope, its value is applied to all the hits in the current web session. When a custom dimension has User level scope, its value is only applied to all the hits in the current and future web sessions, until the value changes or the custom dimension is made inactive.

Note: You can’t delete a custom dimension or metric once you have created it. All you can do is then make it inactive if you don’t wish to use it.

Step-4: Once you click on the ‘create’ button you will be shown the example code for your custom dimension. Just click on the ‘Done’ button for now. You have now created your first custom dimension.


Step-5: Now click on the ‘custom metrics’ tab and then on the ‘new custom metric’ tab to create your custom metric as shown below:


 Here formatting type can be ‘integer’, ‘currency’ or ‘time’. It is actually the data type of the value your custom metric will store. I have specified minimum value of my ‘phone calls’ metric as 0, as you cannot get number of phone calls in negatives (like -10, -15 etc).

Step-6: Once you click on the ‘create’ button you will be shown the example code for your custom metric. Just click on the ‘Done’ button for now. You have now created your first custom metric. Similarly create your other custom metrics:


Step-7: Now comes the hard part (really hard part if you choose to do it yourself). You need the help of a web developer now. Forward the following example code for your custom dimension to your developer:


Note: You can get this example code by clicking on the name of your ‘custom dimension’

Similarly forward example code for each of your custom metric to your developer. Following is an example code for a custom metric:


Note: You can get this example code by clicking on the name of your ‘custom metric’

Ask your developer to follow the environment (like SDK for Android, SDK for IOS) specific instructions in developer guide and populate the fields like ‘SOME_DIMENSION_VALUE’,  ‘SOME_METRIC_VALUE_SUCH_AS_123’ etc with the actual values. He/she will write a script to do that.  So eventually it is my developer who sent the values for custom dimensions and custom metrics from call tracking software to UA reports through his code.

Step-8: Now create a custom report in UA with ‘Phone Call Keywords’ as primary dimension and ‘phone calls’, ‘admissions’, ‘call cost’ and ‘call duration’ as metrics. Once you start getting the data, you will see a similar report:




Should you upgrade to Universal Analytics?

UA is most useful for multi-channel retailers (those who do multi-channel marketing both online and offline). UA is not useful for every type of website/business. For example UA is not very useful for, as I don’t run an e-commerce store and I don’t have an offline store/presence.  So before you switch, you need to evaluate your business/marketing needs to use UA. Not everybody needs UA.

Even if you decide to use UA, instead of upgrading, consider running Universal Analytics in parallel to your standard GA account at least for the next 3 months and see how it goes. This is what I have being doing. You can do this by adding both GA and UA tracking code on all the web pages of your website. Avoid removing the standard GA tracking code just to implement the UA tracking code on your website for the time being. This is because:

1. In UA almost everything from cross domain tracking, event tracking to e-commerce tracking is handled differently and there is not enough support available from Google and other analytics users yet. If anything goes wrong you are pretty much on your own.

2. UA is still in beta. Which means it is not very reliable. I have noticed UA treating organic traffic as direct traffic in some cases and there are some other issues too.

3. Remember the technical expertise needed to implement Custom dimensions and metrics. I have made it look all simple for you in this post. But the implementation is not that easy. Don’t remove the standard GA tracking code from your website unless you are absolutely confident in your ability to do all the work in UA.

To learn more about upgrading to Universal Analytics, check out this post: Universal Analytics Upgrade Guide

Other Posts you may find usefulCommon Google Analytics Mistakes that kill your Analysis, Reporting and Conversions

Subscribe to my blog
Join my free newsletter and learn to avoid the analytics mistakes everyone seems to be making over and over again.


About the Author:

My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help.Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from SEO, PPC or Web Analytics.



  • analytic geek

    good one! bookmarked

    • Ankit

      Really nice

  • Moe

    Thanks for the awesome post as usual. What I am wondering is, will UA link the offline conversion to the online visit, or it will just collect offline and online data separately.

    For ex.: If a user visits a website, then calls the office. Will we be able to see the keywords that drove the phone call conversion, or will it just report a phone conversion with no attribution to the online source?

    • seohimanshu

      UA can link the offline conversions to the online visits, keywords etc. That’s the main purpose of using UA.

      • Moe

        Yeah I know, although they will use a unique client ID to identify visitors. What I am missing though is how will it be able to provide the caller the same client ID as the one given to the visit.

        How will it be able to identify that this visitor that came to the website is the same as the one that called thus giving it the same client ID,

        • seohimanshu

          Almost all call tracking softwares are able to connect each phone call back to the originating source and keyword and assign them unique client ID. They are able to do this by a special tracking code which they ask us to put on our website. I don’t know exactly how this tracking code works but it is able to do the things you are talking about.

  • Beatriz López

    Hi! first, thank you very much, a really completed post. Congrats because it is useful. However I have tried to add the universal tracking code just behind the google analytics one and save in my website (, header.php file). I did it in header.php file but I cannot see UA working. Just few questions, any tip? is it configure (in a pararell way) at account or web profile level? Do I need to ask any kind of special access? I doublechecked in real time reports with no result. Thanks in advance! Bea

    • seohimanshu

      Hi Bea! It is hard to diagnose your problem without actually looking into your account. Make sure that the formatting of your UA tracking code is correct. Sometimes change in formatting can stop the tracking code from working properly. Any extra comma, space or character can stop your tracking code from working. Copy-paste the UA tracking code from your Universal Analytics account directly into your header.php file. Then check the source code of your home page and search for ‘analytics.js’ file. If you can see this file in the head section of your web page then the UA tracking code is installed otherwise it is not installed. UA is set up at the property level if you have multiple web properties otherwise on the account level. You may have to wait for up to 4 hrs once you have set up the new tracking code before you can see any new data.

      • Beatriz López

        I got it:) Thank you very much for your words and support, really appreciated. It was a matter of time, you we’re right, I haven’t done any change and started capturing data:) I will continue working and going into more detail.
        On the other hand, I have prepared a post in Spanish with my research and steps I have followed. I have mentioned your blog – just FYI
        Thank you again for your time, all my best, Bea

        • seohimanshu

          Thanks for the mention and reading this post.

  • vimal

    Awesome Post!!

  • alvaro

    Thank you very much for this wonderful article!!

    • seohimanshu

      I am glad you find it useful.

  • Muhammad Ali

    Very Informative, Very Juicy, Very Clicky. Himanshu Keep Sharing Good Stuff.
    Best Regards

    • seohimanshu

      Thanks for the kind words

  • Hugo


    Very good tutorial, thank you very much !

    One small question though: where should you drop the scripts used to populate custom variables / metrics ?


    • seohimanshu

      You place the script on the page where you want to collect the data.

      • Hugo

        Yes, I guess so,but is it to be placed above the main UA script or below ? Does it have no importance whatsoever ?

        Thanks :)

        • seohimanshu

          Generally all the code is placed below the main UA script.

  • Ryan Cruz

    Thanks for creating this guide Himanshu, I was wondering if you experience different numbers of visits and goal completions when you run Classic and Universal Analytics together? Any thoughts on why these things happen?

    • seohimanshu

      It is possible if GATC and UATC tags are not installed correctly on every web page.

      Other and more important reason is that UA fundamentally provides more ways to collect and integrate different type of data than GA. So it won’t be a surprise if you see very different number of visits and conversions in case of UA. Since UA is better than GA in integrating different type of data, you will usually see lower volume of visits and conversions in case of UA. Best practice is not to compare data like this.

      If you are using UA than you should avoid taking business decisions based on the traditional GA data.

    • Guest

      I Ryan, Did you find any good answer/solution to this problem? All the sites where I am running both analytics.js and ga.js have a between 15% and 20% discrepancy in traffic (with Universal reporting less visits).

      • Eduardo Hoffmann

        I had noticed a difference of almost 20% between the Classic and Universal Analytics data too.
        I took some time to discover that the mobile site was with only one of the tags installed on it. That was why this difference occurred.
        Now the difference is less than 1%.

  • BoneyardHauntedHouse

    I have set up Universal Analytics and am now tracking everything around the house. When the garge door opens / closes, the exaust fan in the bathroom (some people never turn it on) now I have proof. This is very cool and I can track event in RealTIme view.. What I have not been able to do is figure out how to view the data in reports? once it scrolls past the RealTime events page its lost? Any tips on Reports for Universal Analytics? Thanks

  • Dave Davis

    Awesome! Thanks so much!

  • Wigid

    Hi Himanshu,
    This post bring me to your site and suddenly I just already read 3 of your posts!
    congratulation, now you have new follower :)

    I have question regarding Universal Analytics, is it possible to track non website and non apps/android application using it?
    Let say I’m about to distributing offline content to my costumer via CD rom, to see if they use it or not, I would like to embedding UA on my html content, so if they are able to connect to the internet, I can get the report of my product.

    I have generating new UA tracking profile, but when it asking my url, i’m not sure if I can put any valid url on for the new profile.

    • seohimanshu

      You need a website or app to open a UA or GA account. You however can integrate it with other data sources with the help of your developer.

      • wigid

        What is purpose of the website? Only for store data or there is any other purpose?
        Can I use URL that not really accessed by my application?

        • seohimanshu

          GA is primarily designed to track online user activities on a website or an application which you own or control. UA extend the capabilities of GA by letting you track offline user activities which may be impacting your online data. But in the end you need a web property (whether website or app) to use GA/UA. So for example you can’t use UA to track your offline physical store’s sales if you have no online presence.

          • Wigid

            I have found the answer.

            basically what I need is using Measurement Protocol to send the data.

            thanks for your help!


  • Valentina

    Good Read.. very helpful. I have a question though.. The referral exclusion option provided in UA, does it also work if you have sub-domains and dont want them to appear as a referral? I’m assuming if thats the case, the setDomainName is no longer needed?

    • seohimanshu

      Never tried that. Why would you want your sub-domain traffic to appear as a direct traffic? If you do not want sub domain to appear as a referral then use cross domain tracking

      • Valentina

        I am currently using the sub domain code on my pages. However, I still see them as a referral. Im trying to track my mobile site which is, using the setDomainName tag. The code is on all pages.. Is there anything else I might be missing. Also, is _gaq.push([‘_setDomainName’, ‘’]); different from _gaq.push([‘_setDomainName’, ‘’]);

        • seohimanshu

          yes _gaq.push([‘_setDomainName’, ‘’]); is different from _gaq.push([‘_setDomainName’, ‘’]); you can create a filter which will exclude all the traffic from

          • Valentina

            Sorry, tht was a typo.. I meant does having the period before the domain name matter? like ‘’

            • seohimanshu

              yes. We don’t normally enter ‘’.

  • Zzz

    Great article, how come regular events don’t show on UA? I only get real time..

  • Aditya

    Thank for himanshu ! nice article as always.

    • seohimanshu


  • Kaushik

    Awesome post very detailed and informative. Thanks.

    One question though:-

    Earlier (ga.js) we could get trafic source and medium from __utmz cookie, but since this is not available any more I try to get it in the following manner:-

    ga(function(tracker) {
    var src = tracker.get(‘campaignSource’);

    But it always logs ‘undefined’. The field ‘campaignMedium’ also returns ‘undefined’.

    But I get correct values for some fields like ‘clientId’ or ‘screenResolution’ or ‘language’.

    Is there some other process to get these infromation?

  • Kurt Peterson

    Solid post, Himanshu. One question: can you tell if the search terms exclusion function also redirected any branded terms currently being hidden by (not provided) into the direct traffic bucket? Or is it only for organic traffic with a keyword referral?

    • seohimanshu

      yes excluded branded terms are also treated as direct traffic.

      • Kurt Peterson

        Including the portion hidden within (not provided) traffic due to SSL search?

        • seohimanshu

          the excluded branded terms won’t be hidden within not provided. Otherwise this will corrupt the data. You will just see them in the form of direct traffic.

  • Sidd

    Dear Himanshu, thank you for such a detailed post. I want to track logged in and guest users using Universal Analytics. This is basically to see the user behavior of the two. How do i go about it? I mean once i set up custom dimensions and metrics, what directions do i need to give to the developer?

    • seohimanshu

      Hi Sidd! The directions are mentioned in the post, including the language you can you use so that your developer can understand what he/she needs to do.

      “Ask your developer to follow the environment (like SDK for Android, SDK for IOS) specific instructions in developer guide and populate the fields like ‘SOME_DIMENSION_VALUE’, ‘SOME_METRIC_VALUE_SUCH_AS_123’ etc with the actual values. He/she will write a script to do that. So eventually it is my developer who sent the values for custom dimensions and custom metrics from call tracking software to UA reports through his code”

      • Sidd

        I have followed exactly what was mentioned in the article, but still the data is not coming through. I have set the scope as User in the custom dimension definitions, is it correct or should it be changed to session/hit. Also, since i just want to get the pageviews, visits, bounce etc, i am not creating custom metrics. We have gone through the google analytics help files, but still are unable to fix the issue. We are creating this for a website and not apps.

        • seohimanshu

          Set the scope to hit.

          • Sidd

            Dear Himanshu, the implementation is complete, but the numbers are not matching. Meaning guest+logged inuser should be equal to overall pageviews. From Secondary dimension, it’s falling short of the number. So i created an advanced segment. in this case, guest+logged in user actually exceeds the overall number. How can that be fixed?

            • seohimanshu

              How did you come to the conclusion that Guest+logged in user should be equal to the overall pageviews? Any guest or logged in user can generate multiple pageviews from multiple devices.

  • Alitre

    Great article!
    I have a question about emailing reports say on a daily basis. Is there anyway to include a secondary dimension within an auto report? When I have tried it only includes the primary dimension.
    Any help would be much appreciated!

  • Ruhani Rabin

    This was helpful. I was really looking for the typical utm source based external link tagging. How am I gonna do that in UA? previously we use tools like analytics URL builder. How to implement similar for the new UA. Please note I am not using the old GA.js library .. I am only using the new analytics.JS. I would really appreciate a little tip on this. Thanks man.

    • seotakeaways

      Hi Rhuani! Sorry for the late reply. You can use analytics URL builder for UA too.

      • Ruhani Rabin

        Hi seotakeaways,

        I’ve tagged some links but haven’t seen them in UA so I went back to older version GA.

  • Rami

    Hello, great writing, one question though in Custom Metrics. If I set a custom metric, it’s possible to view it in my custom report even if I don’t create a custom dimension correct? It can be linked to Source, Campaign, etc…?


    • seotakeaways

      Hi Rami! Sorry for the late reply. Somehow i missed your comment. You should be able to use custom metric on its own without any need to first develop custom dimensions.

  • Andrij Harasewych

    Erg, I’ve noticed that when both codes are installed – a single user counts as two!.

  • Corey Dilley

    Great post, Himanshu. Just have one question about Custom Dimensions. Is it possible to collect (and report on) 2 values within 1 dimension? For instance, if your client had someone contact them about drug rehab AND alcohol rehab, is there a way to tag it with both values and record the metrics in both rows, even though it’s referring to 1 occurrence?

  • Simon Renert

    Does anyone know, how do I retrieve an existing value of a set custom variable using the new Universal Analytics code? For example, the old ga.js code used to be like this:

    var pageTracker = _gat._getTrackerByName();
    var visitor_custom_var_order_count = pageTracker._getVisitorCustomVar(5);

    I know that to set a custom variable I would use something like this:

    Is there an equivalent ga(‘get’,’dimensionX’) call?

  • audrey berlons

    Hi, after i have created java script code in ga – where do i need to insert these lines? Only on page with phone number? or in entire site ( basic stupid question

    • seotakeaways

      Which lines?

  • SSN

    Thanks for the detailed info! if we collect UTM data from GA and include it on our customer accounts in our CRM. What changes would we need to make to continue tracking them on UA?

    • seotakeaways

      you don’t need to make any changes.

  • Kaushal

    Great Post! I have a question, Could you tell me if event categories and labels can be accessed in custom reports? I want to build custom reports to see which events lead to Goal conversions. What is the best way to do this? Thanks!!

  • Jürgen


    Maybe you can help me with my question.

    I am currently using the Google Analytics API and the magic script by Nick
    Mihailovski for reports. Can I still get the data from my Analytics
    accounts with my core reports once I have implemented Universal



  • Lakshmi

    What does tracking is visitor based than visit based mean? Can you please explain more ?

  • Karthikeyan Sankaran

    HI Nice Stuff, We recently migrated from the old ga.js to universal access method however we are facing a different issue which is …. the few page views are getting captured in the old account and few are getting captured in the new account. Now when we go to the pages captured in the old account and check the source code we find the new code in it …. not sure how google is capturing it in the old account … can you help us on the same….

    • optimizesmart

      Are you sure you have migrated to UA or are you running UA in parallel with GA. You can’t go to old account after migration.

  • Nick Aster

    Great stuff. A couple basic questions:

    1) Once I get this code:

    var dimensionValue = ‘SOME_DIMENSION_VALUE';
    ga(‘set’, ‘dimension1′, dimensionValue);

    Where do I paste it? Inside the GA code? Why can’t Google give real instructions as to where this goes?

    • optimizesmart

      yes you can include the code in your Google Analytics Tracking code. But it really depends upon what you are trying to do with custom dimensions. For example if you are tracking people who scroll your website contents very fast via a custom dimension called ‘scroller type’ then you may need to place this code in your scroll tracking script. There is no one answer to your question.

  • Pragya

    Thanks Himanshu for explaining it so well.

  • Nosa Jeffery

    I am Jane from USA, after 9 years in
    marriage with my husband, he divorced
    me and brought in another lady, i did all i
    could to get him back but all
    proved abortive, until a old friend of mine
    told me about a spell caster on
    the internet who helped her in a similar
    issue at first i doubted it but
    decided to give it a try, when i contacted
    him he helped me cast a re-unite
    spell and within 48 hours my husband came
    back to me apologizing and today
    we are happily together. Contact this great
    spell caster on your
    relationship or marriage problems at

  • Nosa Jeffery

    My Name is Stacey Fernandez, From Canada I wish to share my testimonies with the general public about what this man called Dr odoko has just done for me , this man has just brought back my lost Ex husband to me with his great spell within 24 hours. I was married to my husband Alans Evans, we were together for a long time and we loved our self’s but when I was unable to give him a child for 2 years he left me and told me he can’t continue anymore then I was now looking for ways to get him back until a friend of mine told me about this man and gave his contact email then you won’t believe this when I contacted this man on my problems he prepared cast a very strong spell for me and bring my lost husband back within 24hrs, and after a month I miss my monthly period and went for a test and the result showed that i was pregnant. i am happy today am a mother of a baby girl, thank you once again the great Dr odoko for what you have done for me.Contact him on his private email

    1) If you want your ex back.
    (2) if you always have bad dreams.
    (3) You want to be promoted in your office.
    (4) You want women/men to run after you.
    (5) If you want a child.
    (6) You want to be rich.
    (7) You want to tie your husband/wife to be
    yours forever.
    (8) If you need financial assistance.
    (9) How you been scammed and you want to recover you lost money.
    (10)if you want to stop your divorce.
    (11)if you want to divorce your husband.
    (12)if you want your wishes to be granted.
    (13) Pregnancy spell tp conceive baby
    (14)Guarantee you win the troubling court cases & divorce no matter how what stage
    (15)Stop your marriage or relationship from breaking apart.
    once again the email address is my contact is +2348143877990

  • Nosa Jeffery

    Hello everybody, my names is Cindy Davis Am from Canada i want to give thanks and honor to Dr.ODOKO for the great work he did for me, he brought my lover within 24 hours which i never taught it will ever come through in my life, but this great man Dr. ODOKO proved to me that powers can do wonders, i got his contact from a friend in the USA who he helped, this friend of mine told me that this man is great but i felt as hmm are you sure? cause i hardly believe those kind of things,so she told me not to worry that when i contact him, that she is guaranteeing me 100% that my lover will come back that if it does not work that she will be the one to give me back my money, to show her sincerity to me, she gave me her car that if it does not work that and she did not pay me the money that i spent that she i should collect her car and she gave me all the documents, i was so so surprised she was very serious about it so that was how i contacted him and i told him what i want he just told me that everything will be done within 24 hours so with the assurance my friend gave me i was having confident, so in the next 24 hours that he told me i just heard a knock on my door i never knew it was mark, so that was how i opened the door the first thing he did was to go on his knees, he started begging me to forgive him that he is very sorry for everything, i was really surprised and was also happy, so that was how i forgive him and now we are living together happily than ever before, and am using the media to invite my friends on my wedding which will coming up on 30/10/2013, am very happy thanks be to Lucy who gave me his contact and honor be onto Great DR. ODOKO who helped a lot, if you need his help or you want to thank him for me you can contact him through

  • Nosa Jeffery

    My name is Conrad Eve, my family and i live together live in USA. It was after seven years i got to discover that my Husband was unfaithful to me. I didn’t know what was going on at first but as he got deep in the affair with his new lover, i felt that our marriage was on the rocks. I notice that he no longer light up when i touch im or kiss him in his neck and his chest cos he really liked it when i did that, he also usually get naked in front of me but when he started seeing that woman he stopped it. I remember asking him if i have done anything that makes him feel irritated when i am around him then he gives silly excuses that he has been feeling stressed up and that he need space for a while. I know when you are been asked for space its usually because there is something fishy going on. I hired a private investigator to help find out what was going on. And in a week time he brought me prove that my Husband that i have lived with for seven straight year is cheating on me with his high school lover. I had picture of him walking out a of a restaurant with her and many other photo of them kissing in public like he will never be caught by someone that knows he is my Husband. I asked myself, even when we had a daughter toghether he could do this to me. That same night i showed him the pictures that i got from my private investigator. He didn’t look at it before saying, that he is seeing someone and he know that i just found out about it. Then he said that he is in love with her. At that moment, i didn’t know if to kill myself or to kill him but the button line is that if i was going to kill anyone it was going to be me because i was so much in love with him to even think of thinking to hurt him. As time goes on he asked for a divorce and got it and i got custody of our daughter and i weep everyday seeing my daughter with out being around her daddy. I just couldn’t get my mind off my Husband and all i could think about was getting him back and live as every family should. For a year i tried all i could to get him back with the help of my seven year old daughter. Even at that all effect was in vain, i used the help of his friend but turned out all bad. I know most people don’t believe in spell casting but believe me this was my last option and the result i most say was impressive. And i know it difficult to believe but A SPELL CASTER DR. odoko really made my life much better because he gave me my family back. He didn’t ask me to pay for what he did for me all i was to do, was to provide the materials for the spell and i should believe that he had the power to help me. Like he said, he was going to do something that will make him reset his love and affection for me just as it has always been. My Husband told me he woke up and realized that he should have never left me that i am all he needs.To make thing clear, his life with his high school lover was great before DR odoko cast the spell, they had no disagreement on anything. My Husband said it himself that why he broke up with her is something he can not explain just that he woke up on the same bed with her after a very romantic night saying he is breaking up with her for no reason at all. Only DR odoko can do such a
    thing, contact him to solve your problem with his email