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.


abc-123-rst,Albert Cox,,Real Cube,Colombia
abc-123-uvw,Justine Bishop,,You Span,Panama
abc-123-xyz,Paula Smith,,Skinte,Romania
abc-456-rst,Louise Mcdonald,,Meezzy,Turkey
abc-456-uvw,Christopher Burns,,Midel,Algeria
abc-456-xyz,Laura Ruiz,,Zoo Veo,Austria
abc-789-rst,Julie Ramirez,,Meetz,Ukraine
abc-789-uvw,Jimmy Elliott,,TwitterList,China
abc-789-xyz,Amanda Owens,,Avamba,Indonesia
def-123-rst,Denise Stephens,,TagTune,India
def-123-uvw,Betty Watkins,,PhotoBug,"Congo, Republic of"
def-123-xyz,Daniel Rose,,SkipStorm,Djibouti
def-456-rst,Paula Baker,,Blue Zoom,Luxembourg
def-456-uvw,Kevin Arnold,,DynaBox,New Zealand
def-456-xyz,Gerald Black,,Sky Bar,Ukraine
def-789-rst,Donald Dixon,,Trilia,Turkey
def-789-uvw,Julia Tucker,,Centizu,Ascension Island
def-789-xyz,Elizabeth Gilbert,,Kanoodle,Bulgaria
ghi-123-rst,Barbara Ross,,DigiTube,Gambia
ghi-123-uvw,Rose Oliver,,Vitz,Morocco
ghi-123-xyz,Louis Mills,,Skyble,Bosnia and Herzegovina
ghi-456-rst,Angela Dunn,,WikiBox,Saint Barthelemy
ghi-456-uvw,Anna Ward,,DAB Jam,United States
ghi-456-xyz,Evelyn Simpson,,Rhyzio,Canada
ghi-789-rst,Joe Green,,JA Loo,Kiribati
ghi-789-uvw,Patricia Hayes,,Lazzy,Chad
ghi-789-xyz,Bruce Chavez,,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 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:

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');

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:


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:


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.