When I engaged with a new web design client, one of the first things I do is review their Google Analytics of their current site to look for trends and patterns that will help in building the new site.

However, this often can be a problem. If you’re lucky, the client has access to the account and you can simply give them instructions on how to invite you to become a user for it. Often, though, the client does not have access to the account or may not even know it exists!

Let’s fix this, because you need to have analytics on all the web properties you manage.

Identify the Google Analytics Account

To find the Google Analytics Account on a website, you can view source on the page, look between the <head> tags and find the GA code. If it’s a wordpress site, there will be a lot of code in the head tags so I search for “analytics” or “google” in the view source window to find the code. It will look something like this:

<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXX-12’]);
(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);

Or this:

In this case the third line contains the account number, which is preceded with “UA”. (I’ve replaced the account number with Xs.)

Ask the Client if They Have Access to the Account

This is the easiest way. The client can go to the Google Analytics login page and try their account. If they are able to log in and see their site property, then they can invite you to become a user for it.

Ask the Former Web Developer for the Account Information

This can be easy or hard, depending on whether the former developer is willing or able to help you. As above, ask them to invite you to become a user.

It they refuse then chances are you are stuck from a technical standpoint. You may be able to pursue this from a legal standpoint, but I have not had to do this.

When You Can’t Get Access to the Google Analytics Account

If neither of the above worked, then it’s time to do a little more work.

First, note the Google Analytics account number you got from the source code.

Second, you’ll need to be able to access the root directory of the website. Google will ask you to upload a verification file to the root directory. So try to get FTP access to the website. If you can’t get FTP access then you may be able to upload the file via the hosting company control panel or via a WordPress plugin such as File Manager.

Third, a simple text editor.

Finally, go to this Google Analytics help topic that explains takes you through the process of creating a verification file and submitting it to Google for approval.

Google will want you to create a .txt file with the following in it:

GooGhywoiu9839t543j0s7543uw1 – pls add {INSERT EMAIL ADDRESS} to GA account {INSERT UA-ID} with ‘Manage Users and Edit’ permissions – date {INSERT DATE}

An example of the edited file, after you’ve replaced the items in the brackets “{}”:

GooGhywoiu9839t543j0s7543uw1 – pls add [email protected] to GA account UA-XXXXXXX-12 with ‘Manage Users and Edit’ permissions – date 01-24-2009.

Save the test file as “analytics.txt”. Note, once I converted this to plain text I also replaced the quote around ‘Manage Users and Edit’.

Upload this file to the root directory of the website, so it can be accessed by going to “domain.com/analytics.txt”.

Now you need to contact Google via this Google Analytics troubleshooter form.

I don’t know about you, but sending an email via a form to a giant company such as Google always feels like throwing a message bottle into the ocean. Good luck!