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)
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.