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 http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html)

Example

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.

 

 

Comments

  1. It’s a gray area, but in my opinion an ID allows you to personally identify a customer, and is therefore a PII. Otherwise the terms of use would simply say “do not store names”.

    However, I believe GA Premium does allow storing PII.

    • GAPremium says:

      The same argument can be made for transaction id in eCommerce tracking where you even have the city and state information. So like you said, it is a grey area. Those who have used it have not been questioned.

  2. The T&C’s for GA do not allow you to use a unique key to reference PII data by “any source” so while the above does work unfortunately it will break the t&c’s. Premium however does however let you do so via just that method.

    You will not (and will not allow any third party to) use the Service to track or collect personally identifiable information of Internet users, nor will You (or will You allow any third party to) associate any data gathered from Your website(s) (or such third parties’ website(s)) with any personally identifying information from any source as part of Your use (or such third parties’ use) of the Service.

    http://www.cardinalpath.com/google-analytics-and-crm-integration-for-powerful-email-campaigns/

Leave a Reply to GAPremium Cancel reply

*