This is a second post in a series covering how to use Google Analytics (GA) to track game play behavior. One common request we hear is how would you track the demographic traits of the players in your game. The way to do this can be accomplished using GA custom variables. We will cover the basics here of how to track this in the game and how to set up a GA custom report to view demographic reports.
Adding gender and age to GA tracking
If you are familiar with GA, you know that you need to initialize the GA with something that looks like this (more at http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html):
var _gaq = _gaq || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
After you have this set up, assuming that you have access the players gender, you then issue call like this
This call effectively uses the 2nd custom variable slot, names it “Gender”, and sets this particular visitor to being a “male”. The last parameter “1″ sets this custom variable to be a player level variable, and will persist for 24 months as a cookie.
The same technique can be used to set the variable “age”, by putting it into the 3rd custom variable slot.
GA Reports using these gender and age variables
Under the standard reports, you can click on the demographic section on the left.
Which should then give you this type of custom variable report, click on the “Custom Variable (Key 2)” in order to view the 2nd slot custom variable.
Now if you click on the Gender Link, you should get down into the specific breakdown of gender:
Pretty cool and easy to do!
Custom gender and revenue report
Now what happens next is that you might be interested to see how much revenue or how many unique players you have from the different genders that you are tracking. One way to do this is via the custom report function in GA. Just click on Custom Report, +New Custom Report and make sure to select the Custom Variable (Value 02) as the dimension (see screenshot below)
Voila, you get this revenue and unique player report by gender!
Or if you want this report shown, click on this link and save this custom report into your own GA profile! https://www.google.com/analytics/web/permalink?type=custom_report&uid=XM7tyla_RL2eBgjS1LY3vw