Website Performance - We can Help - Merkados
Website Design Promo

Cross Domain Tracking with Universal Analytics.js – Google Analytics.

November 14th, 2014 admin

So I know that you could go to the Google Analytics blog and simply try to understand all the information that they have to offer about how to track several domains with the same Google Analytics Profile. However, I wanted to post a simpler way to get going fast and easy with the cross domain tracking without having to spend 3 hours. Before we begin, let’s say why this is important. Let’s say that you have an e-commerce cart, and let’s say that that e-commerce cart is located in an external domain. If you implement Google analytics the normal way you’re going to end up increasing unnecessarily the referral count. More importantly those referrals are going to show as if they are coming from your own website.

So, without further adieu, let me share with you the secrets of implementing cross domain tracking in Google Analytics, specifically with the universal tracking code.

Read the rest of this entry »

Track Scrolling in a Page (Engagement) with Jquery and Google Analytics

December 20th, 2011 admin

So I came across a post by RTP Harry from http://runtingsproper.blogspot.com/2010/03/google-analytics-tracking-content.html where he explains how to track scroll depth in Google Analytics.

Since I was looking for exactly that for one of our projects I was excited to give it a go. However it didn’t work. And so I started in my usual journey of understanding why it wasn’t working, fixing it and then sharing it with all of our readers. So here it is:

Problem:

You want to track the engagement of your users and therefore you would like to see in Google Analytics if your users are scrolling down your pages and reaching at least 90% of the length. Read the rest of this entry »

The Google Analytics Cheat Sheet

September 14th, 2011 admin

Hi again everybody. This link is probably the most important of links for people out there doing more than the basics with Google Analytics. In other words, if you are just installing the code and then looking at reports and interpreting the information, this link is of little to no value for you. However, if you are looking into trying some custom segmentation, adding search engines, linking domains and sub-domains and advanced profiling Read the rest of this entry »

Need the IP address of your visitors in Google Analytics Reports? Is it possible?

October 1st, 2006 admin

In short: YES YOU CAN! Even though Google has blocked the ability to gather IP information out of the box from your Google Analytics reports, you can resort to PHP to “introduce” them back. This is based on the fact that by using Google Analytics you shouldn’t be able to identify specific users and their behaviors. There is an easy way to still gather the IP’s if you don’t mind using also a little bit of php (Apache server is the best way to go). Use the following code in your body tag (I would use it only in the home-page.

Remember, this is using PHP:

First you need to insert a combination of php and javascript in your website. Also, you need to understand that you will be using the “__utmSetVar” Javascript tag. This tag will allow you to set the user-defined field in your G.A. interface. You can only set this value once. If you set it twice, it simply will overwrite your previous value.

Now before we continue, please take two minutes of your time to register and gain access to the solution, it is free by the way.
[private]

The PHP

First the PHP code: (NOTE:Your homepage has to be a php page, otherwise it won’t run, this is obvious right?).

<?php echo $_SERVER['REMOTE_ADDR']; ?>

This basically says: “print the IP address of the visitor according to the browser in the page being displayed”

Then the javascript part:

<body onLoad="javascript:__utmSetVar('Something to create segmentation')">

This part says: “when the body element of the DOM loads call a javascript function named: utmSetVar, this function assigns a segmentation value to your Google Analytics User Defined field in the reports”.

The code you include in your page:

So when we combine the php and the javascript it should look like:

<body onLoad="javascript:__utmSetVar('<?php echo $_SERVER['REMOTE_ADDR']; ?>')">

This is the code that you need to include in your page. That is it. After a couple of hours you will start seeing the IP addresses of your visitors in the user-defined field of the visitor panel in your Google Analytics account. Couple of things before wrapping up:

  • 1. Remember that if you just placed this code in your homepage, the user-defined field will only show the IP addresses of those visitors that visited the homepage, conversely, you won’t be able to see the IP of those who don’t.
  • 2. You have to be able to run PHP in your homepage, therefore in a regular HTML file this code won’t work.
  • 3. Remember that from the moment you add this segmentation it will record all those IP addresses and therefore they are there for the long run, you can’t delete them from your reports unless you delete your entire profile, so make sure that you want them there.
  • 4. You can create segmentation like this for almost any information sent by the browser or the server, however, you only have 1 user-defined field in Google Analytics, therefore once you use it for something, that is pretty much it, you can’t have more than one user-defined segmentations of this kind.
  • 5. It is important to understand, if you were going for a Google Analytics filter ip, this won’t work. Why? This change happens in the website level, so all the profiles will have this information. I guess you could technically create a profile and then create a filter in that profile to block the ip information, but it would be a bit cumbersome.

Watch a free VideoCast about this technique.

Also make sure to contact Merkados in Raleigh, if you would like to learn more about website design, interactive marketing or if you want to build a new website with full analytics integration.

Update 2012

So one of the questions that we received is where can we see this information in the new, updated Google Analytics platform. The answer is to go to:
Audience > Custom > User Defined

You’ll find your IPS showing up there.

The Old Way (doesn’t work anymore)

This is the other way (not functional anymore) that you used to be able to accomplish the gathering of IP’s in GA if you want to apply this knowledge to other filters in Google Analytics.

Steps:

  1. In GA, go to the “Edit” menu for the profile that you are trying to collect IP addresses from. (This is located next to the “view reports” link for every profile.
  2. Scroll down to the third box “Filters for Profile”, and click on the link: “add filter” located at the right top section of this box.
  3. The settings will be the following:
    1. :: Add new Filter for Profile
    2. Filter Name: “IP Address”
    3. Filter Type: (Dropdown menu) Select“Custom Filter”
    4. Then from the radio boxes select: “advanced”
    5. In the first dropdown box: Field A: select the following:

i. Visitor IP Address

    1. In the text box next to it type the following:

i. (.*)

    1. In the next dropdown and text box don’t include anything.
    2. In the last dropdown box: Output to: select the following:

i. User defined

    1. In the text box next to it type the following:

i. $A1

    1. Field A required = yes
    2. Field B required = no
    3. Override Output Field = yes
    4. Case Sensitive = no
    5. FINISH

Once you had setup the filter like this you were able to see the IP addresses of your visitors by selecting the user defined menu in the visitor performance menu or by cross segmenting by user defined variable. Remember that you don’t want to place this filter if you are collecting any other custom segments in your site since you will overwrite those. If your tracking code is the same in every page of your site and you had no previous filters then you have nothing to worry.

That is it.

If you need more valuable information you can search the user-forum for Google Analytics at: http://groups.google.com/group/analytics-help

[/private]