A few weeks ago, the Google Analytics team released some fantastic updates to their software. Of particular interest to me was enhanced mobile tracking and reporting capabilities.
The first thing to understand about mobile website reporting is that it works differently than regular websites. Many mobile browsers do not yet support javascript, the language that platforms like Analytics depend on to track website stats. Instead of the browser doing the work, mobile tracking leans on some server-side code to track visitors properly.
Don't be intimidated by all the geek-speak though. It's not rocket science to implement analytics on your mobile site. If you've got five minutes, know how to use FTP and don't mind copy/pasting some code, you can do this!
1. Add a new profile
From your Google Analytics account, add your mobile site as a new domain.

2. Get advanced tracking code
Once your site is added, Analytics will give you a Web Property ID like normal. Keep this around for future reference. In the example below, the Property ID is highlighted.
Click on the "Advanced" tab under the instructions heading. Then click on the radio button to select "A site built for a mobile phone". Finally, select the server-side language. I will be using PHP for this example.

3. Insert the snippets
There are two snippets of code that you must copy/paste onto each page of your mobile website. One goes at the top of each page, right after the <html> tag. The other goes at the bottom of each page, prior to the </body> tag.
Note that the third line of the top snippet includes your Web Property ID. This varies for each domain, so be sure to change it if you ever re-use this code.
4. Upload the file
Lastly, you have to download this file called "ga.php" and upload it to the root directory your domain. This means if your domain is m.yourdomain.com, this file needs to be at m.yourdomain.com/ga.php.
5. Test and Celebrate!
Give it a few minutes and refresh the tracking status in Google Analytics. Assuming you followed the directions, you should be in great shape.
Known Limitations
Lastly, it's important to familiarize yourself with the currently known issues, published by Google in the sample code instructions:
- Multiple instances- you can't run multiple copies of the script on your website, or use it in conjunction with the standard javascript tracking code.
- Inaccurate locations- Since Google determines users' location using their IP address, tracking this from a mobile device is not as accurate.
- Server load- Due to the additional code required to track visitors properly, additional server load may be possible.