Sending personally identifiable information (PII) to Google Analytics is strictly prohibited, but sending a unique user ID is permitted. This is a tutorial to aide users of the PII for Google Analytics Chrome extension. The extension allows you to map the user ID stored in Google Analytics to PII such as name and email address stored locally.

The test scenario we're using gives a pseudo-randomly generated User ID to each web page visitor. The "User ID" feature in Google Analytics is currently (April 2014) being rolled out, so in the meantime, we're using a Custom Dimension to store our own "Custom User ID".

On my local filesystem, I have created a set of sample personas in sample.csv which contains "User ID" values along with some personal information. This CSV file contains a header row to describe the columns.

sample.csv:


user_id,display_name,email,company,country
abc-123-rst,Albert Cox,acox@realcube.info,Real Cube,Colombia
abc-123-uvw,Justine Bishop,jbishop@youspan.name,You Span,Panama
abc-123-xyz,Paula Smith,psmith@skinte.name,Skinte,Romania
abc-456-rst,Louise Mcdonald,lmcdonald@meezzy.com,Meezzy,Turkey
abc-456-uvw,Christopher Burns,cburns@midel.biz,Midel,Algeria
abc-456-xyz,Laura Ruiz,lruiz@zooveo.biz,Zoo Veo,Austria
abc-789-rst,Julie Ramirez,jramirez@meetz.org,Meetz,Ukraine
abc-789-uvw,Jimmy Elliott,jelliott@twitterlist.biz,TwitterList,China
abc-789-xyz,Amanda Owens,aowens@avamba.edu,Avamba,Indonesia
def-123-rst,Denise Stephens,dstephens@tagtune.mil,TagTune,India
def-123-uvw,Betty Watkins,bwatkins@photobug.name,PhotoBug,"Congo, Republic of"
def-123-xyz,Daniel Rose,drose@skipstorm.biz,SkipStorm,Djibouti
def-456-rst,Paula Baker,pbaker@bluezoom.net,Blue Zoom,Luxembourg
def-456-uvw,Kevin Arnold,karnold@dynabox.net,DynaBox,New Zealand
def-456-xyz,Gerald Black,gblack@skybar.org,Sky Bar,Ukraine
def-789-rst,Donald Dixon,ddixon@trilia.gov,Trilia,Turkey
def-789-uvw,Julia Tucker,jtucker@centizu.name,Centizu,Ascension Island
def-789-xyz,Elizabeth Gilbert,egilbert@kanoodle.mil,Kanoodle,Bulgaria
ghi-123-rst,Barbara Ross,bross@digitube.edu,DigiTube,Gambia
ghi-123-uvw,Rose Oliver,roliver@vitz.org,Vitz,Morocco
ghi-123-xyz,Louis Mills,lmills@skyble.org,Skyble,Bosnia and Herzegovina
ghi-456-rst,Angela Dunn,adunn@wikibox.gov,WikiBox,Saint Barthelemy
ghi-456-uvw,Anna Ward,award@dabjam.net,DAB Jam,United States
ghi-456-xyz,Evelyn Simpson,esimpson@rhyzio.edu,Rhyzio,Canada
ghi-789-rst,Joe Green,jgreen@jaloo.gov,JA Loo,Kiribati
ghi-789-uvw,Patricia Hayes,phayes@lazzy.gov,Lazzy,Chad
ghi-789-xyz,Bruce Chavez,bchavez@eire.org,EireOrg,United Kingdom

Please note that this data is sample data and not real customer data.

In PII Viewer for Google Analytics, we upload the CSV file into the extension.

Now, the extension is installed locally and it saves the data to the local machine in Chrome's chrome.storage.local API. The point I'm making here is that the PII data is not uploaded anywhere outside of your local machine. This means that your PII data is safe. It also means that legally, you are complying with section 7 of the Google Analytics terms of service.

Next we select a "Select Google Analytics User Identifier column" from the list of columns. In the sample dataset, select user_id.

When setting up the tracking code, this user_id was used in the JavaScript. Something like this:


<script>
...
...
ga('create', 'UA-XXXXXX-Y', {'userId': customUserId}); // If "User ID" feature is available
ga('set', 'dimension1', customUserId); // Set a `customUserId` dimension at page level
ga('send', 'pageview');
</script>

Having configured the extension with the data and the mapping, you can jump straight into Google Analytics and see the extension in action.

The extension adds a small toolbar to the bottom of the Google Analytics interface. You can hide it so that it's out of the way. The extension looks at dimension data displayed in Google Analytics and if a mapping between the user_id in the locally stored CSV file and the dimension displayed in Google Analytics is found, the PII from the local CSV file is injected into the Google Analytics interface.

In our example, we have a Custom User ID dimension added, so we can add this as a secondary dimension to one of the reports.

Our CSV had columns:

user_id,display_name,email,company,country

We used user_id for the mapping, so the other columns are available for selection in a dropdown in the toolbar. Selecting any of these will display the mapping within the dimension columns in Google Analytics like so:

pii-viewer

As the extension maps against any dimensions in the reports, it could lead to some false positives, so I've also added a toggle in the toolbar to switch the mapping off.

In upcoming releases, I'll consider injecting the mapping into different places in the Google Analytics interface.