Archives for March 2012

Tracking Non Google Analytics Campaign Parameters in Google Analytics

Google Analytics can track up to 5 campaign variable of which 3 are required.  Generally, the campaign variables are passed via URL of the campaign landing page.   For example, if you  want to send users to via a campaign then you might use something like utm_campaign=Feb2012bannercampaign&utm_medium=bannerad&utm_source = yahoo&utm_content = 300X250&utm_term=training

In the above URL, all the query parameters are the campaign parameter that Google Analytics needs to track and attribute the click to the campaign. (See How to Track Campaigns in Google Analytics for more details)

In some case you might not have the campaign parameters as formatted above, maybe because you were using some other web analytics tool that required different parameters or somebody made a mistake and the parameters are messed up. Whatever the reason ; you just don’t have the right parameters.

Let’s assume that instead of the URL above, your URL looks like following campaign=Feb2012bannercampaign& medium=bannerad& source = yahoo& content = 300X250&term=training

(Note that none of the parameters contain utm_, e.g. instead of “utm_campaign”, the URL only has “campaign”)

So Google Analytics won’t recognize these parameters as valid campaign parameters and will ignore them.  However you can fix the problem by forcing Google Analytics to recognize these variable as valid campaign variable by using few lines of codes. The way you fix them is by calling a function that sets the new campaign parameter

_gaq.push([‘_setCampNameKey’, ‘campaign’]); 

The above code tells Google Analytics to use ‘campaign’ as the CampaignName parameter instead of the ‘utm_campaign’ parameter

Similarly set other parameters as follows

_gaq.push([‘_setCampMediumKey’, ‘medium’]);

_gaq.push([‘_setCampSourceKey’, ‘source’]);

_gaq.push([‘_setCampContentKey’, ‘content’]);

_gaq.push([‘_setCampTermKey’, ‘term’]);

Using Google Analytics to Detremine Who Visited the Site

Customer and visitors alike visit your site but your Google Analytics reports show you aggregate numbers to show how many visits came, from what sources, how many of the viewed a certain page etc.   But these reports don’t tell who visited your site, weather that is an existing customer or someone who has not purchased anything yet etc.

However, there is a way in Google Analytics that allows you to know “Who” visited the site, what sources they used, what pages they saw etc.

Setting Customer ID in Google Analytics

If you store your customer records in a database or CRM solution then you assign each customer and ID that identifies each individual customer.  Assuming you this ID for individual available either in a cookie or in the web session when that individual comes to your site.  You can extract that ID from the cookie or session and pass it to Google Analytics using visitor level custom variable as shown below to get individual level reporting.

_gaq.push([‘_setCustomVar’,index, name, value, opt_scope]);

(Note: You can get more information about Custom Variable at


Let’s assume that we have that we have a customer “John Doe” identified by customer id 21590 in the database. Let’s further assume that this value is available to us in the visitors online session.

Let’s use the name “UserID” for this custom variable. The slot we will use to store this variable is 3 (You can use whatever slot is available but I decided to store it in slot number 3). The opt_scope is 1 for a Visitor Level custom variable

So the values that we need to set are

index = 1

name = UserID

value = 21590

opt_scope = 1

The way you will set is

_gaq.push([‘_setCustomVar’,1, “UserID”, “21590”, 1]);

Once Google Analytics collects the data you can start to see this data in your Google Analytics reports.


Note: Google Analytics does not allow you to pass in PII (Personally Identifiable Information) data but an id, which on its own does not tell you anything about the person is not PII in my opinion. Google Analytic does not clarify if you can use it or not so use it at your own discretion or consult Google Analytics, if they respond.



What are Filters in Google Analytics

Filters are a way to transform or manipulate the data that shows up in Google Analytics reports. Filters are applied on the data collected by Google Analytics and what you see in your reports is the final outcome after the filter has been applied to your data.

For example if you want to exclude traffic from an internal IPs then you setup an Exclude IP filter and apply it to the profile that you want to exclude the traffic from.  The final reports that you will see in that profile won’t include any traffic from those IPs.

Note: Once the filter is applied then you won’t see the original data in your reports, you will only see the transformed data.  So always apply a filter on a test profile before applying it to your main file so that you don’t accidentally mess up your reports in your main profile.

Google Analytics provides three predefined filters. If those are not the ones that you need then you also have an option to create custom filters.

Predefined filters:

  • Traffic from the domains: This filter allows you to exclude or include only the traffic from a specific domain.
  • Traffic from the IP addresses: This filter allows you exclude or include only the traffic from specified IPs.
  • Traffic to the subdirectories: This filer allows you exclude or include only the traffic to particular subdirectory on your site.

Example of a Predefined Filter

How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic

Custom filters:

  • Exclude Pattern:  Allows you to exclude traffic that matches the pattern that you specify.
  • Include Pattern: This filter allows you to include only the traffic that matches the patter you specify.
  • Uppercase: Allows you to convert a given data into uppercase.
  • Lowercase: Allows you to convert a given data into lowercase.
  • Search & Replace: This allows you to manipulate the information you see in your reports by searching a value and replacing with something else. Say you have called your campaign source as Gogle instead of Google in your campaign URL. You can change it back to Google in this filter.
  • Advanced: This filter allows you to build a new data field from one or two other data fields. Some examples will be covered in future articles.


Examples of Custom Filters:

Regular Expressions and Google Analytics

How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic

Note: Filters are applied in the Rank order, the rank 1 is applied first and then 2 and so on. To change the order use the Assign Filter Order button (see below).  Having the wrong order on filter will lead to unexpected results so make sure you have assigned the right order.

How to Find the Keywords marked as “(not provided)”

A few months ago, Google, the search engine, started encrypting searches for user who are logged into their Google account while conducting the search. As a result of this encryption, the keyword that the visitors search to arrive to your site is not passed in the referring URL. Web Analytics tools rely on the keywords passed in the referring URL to build the search engine traffic report and in the absence of the keywords there is nothing to report, though they still see that the visits came from Google search. So Google Analytics now marks those visits that do not have a keyword but come from Google with “(not provided)” keyword instead of the actual keyword.

Finding those keywords

Google still tracks all the keywords search by logged in users but just does not pass it in the referrer to the site that the user clicks through to. These keywords are available in the Google Webmaster Tools.  To see the report you will have to register your sites in Google Webmaster Tool. Google Webmaster tools will allows you to see all the keywords that were searched, the number of clicks your site got, the average position of your site for those keywords and the landing pages.


(All images provided by – Google Analytics Tips and Tricks)

If you are using Google Analytics then you can connect Google Analytics reports and Google Webmaster tools to get Webmaster reporting within the Google Analytics interface.

However there are three issues with this report when used with Google Analytics (or any another web analytics tool)

  1. You don’t get other metric (e.g. goal conversion) about the visits that arrived from the keywords.
  2. This list of keywords includes not only the keywords marked with “(not provided)” but also the other keywords that you see in Organic traffic report. So you will have to do extra analysis to see which keywords are hidden under “(not provided)”.
  3. If you look at Google Webmaster tool report then you will notice that there are a lot more impressions and clicks than those displayed in the Webmaster report and the Google Analytics report (see below). I was not able to find a reason why Google is only displaying the partial number of keywords, if you know the reason then please let me know.

How to Track Campaigns in Google Analytics

Campaign Tracking in Google Analytics requires you to pass ew campaign variable to Google Analytics. The easiest way for you to do that is by appending these variables in the URL that you use in your campaigns

The five values that Google Analytics can use in Campaign Tracking are

  1. utm_campiagn  – A unique name that will help you remember what the campaign was about.
  2. utm_source  – A name that provides you information on where the campaign was run
  3. utm_medium – A name that provides you information on what medium you used for the campaign
  4. utm_content – This is mainly used in A/B testing to provide you information on what variation was used. Use can however, use it for any additional information that you want
  5. utm_term – This is mainly for providing the keywords if you are running a paid keyword campaign.

Required Variables

Only 3 of the above 5 are required variable

  1. utm_campaign
  2. utm_source
  3. utm_medium

The other two are optional. But if you don’t provide the above 3 required variable then you campaign tracking will not work.


If run a banner ad to promote then I might tag the URL as follows

utm_campaign = Feb2012bannercampaign

utm_medium = bannerad

utm_source = yahoo (if this ad will run on yahoo)

I might use utm_content to pass in the banner size e.g.

utm_content = 300X250

So the final URL will look like utm_campaign=Feb2012bannercampaign&utm_medium=bannerad&utm_source = yahoo&utm_content = 300X250 

Note: It does not matter what order you pass these variables in but keep in mind that the 3 required ones should be present.

To quickly build these URLs you can use

  1.  Google Analytics URL Builder at
  2. Google Analytics URL builder with URL Shortner –

Viewing the Report

Campaign Reports are available under “Traffic Source” section of the “Standard Reporting” tab (see below).



How to Create Goals in Google Analytics

To Create Goals

  1. Click on the Admin link in the profile you want to create the goals in. Admin link is located on the right hand side (see image below)
  2. Click on a +Goal under the Goal Set you want to create this goal under (Also see – What are Goals and Goal Sets in Google Analytics)
  3. On the next screen
    1. Give the Goal a name
    2. Chose “Active” or Inactive” – Inactive means that data won’t be tracked. You will want to do this if you no longer need that goal but do not want to delete it.
    3. Choose The “Goal Type” – Goals are based on URL, Time on Site metrics, Page Views/Visit metrics and Events. Choose the type and it will open a new screen depending on the type you selected. (See below for the various types)
  4. Once all the data is entered click on “Save” button and your goal will be created.
  5. You will start to see these goals in your reports (refer back to “Goals and Goal Sets” post to see the reports)

Various “Goal Types”

There are 4 goals types currently supported in Google Analytics (see the screen above)

  1. URL Destination – You can choose any URL(s) that you want as an end action e.g. thankyou.html
  2. Time on Site – Pick a time that indicates that your site is successful in accomplishing the goals. E.g. visits that spend over 10 mins
  3. Page View/Visit – Pick number of page views/visit that indicate success e.g. visits that viewed more than 7 pages
  4. Event – Choose any event(s) that you want to track as end action