What is Google Analytics for Flash?It gives you amazing in-depth information on your game's players, like this (click to enlarge): [attachment=20694:GA_Dashboard_Large.jpg] This is the actual data from one of my older games on 17/03/2014. I won't tell you which game though. :) Read on, and I will show you exactly how to set up the same metrics for your game.
Why Bother Tracking Metrics?Tracking metrics in your games is important because it allows you to answer questions like: "How many people played my game?"
- More plays means more ads are being viewed by players. If you can say my games get X players, you can use that when negotiating license sales or sequels.
- You can use this information to expand to sites that have not yet hosted your game, or target sites on which your previous games did well when selling your next game.
- Maybe you will find out something that went unnoticed during testing and you can fix to keep players playing.
Which Analytics Service is Best?In my personal opinion, Google Analytics. I much prefer it over everything else I tried. Why? It's reliable, easy to set up, tracks common metrics such as views & hosts, supports custom metrics, and the data can be shared with others. That's basically everything I need from an analytics service. The only downside I have encountered is that it takes 24 hours for the data to update, although there is a real-time view which shows you what is going on right now. Others Before settling on Google's service, I tried a lot of others but found them all lacking in some important way or other:
- I tried Playtomic, but you have to host the server yourself which takes a lot of resources.
- I tried Mochibot, but it's shutting down.
- I tried Scoreoid, but it requires extra work to set up since they don't provide an actionscript API.
- I tried GamerSafe, but it only tracks some basic metrics and has no support for custom ones.
- I tried my own custom PHP+MySQL solution, but it takes a long time to re-invent the wheel and I was worried my host would shut me down if my games become too popular.
- Did I miss any good ones? Please leave me a comment so I can go check it out!
How do I add Google Analytics to my Game?This step-by-step tutorial is for FlashDevelop. If you use Adobe Flash, or FlashBuilder you can still use GAForFlash and the steps are similar but I'm not going to cover it because it's not what I use. Set Up your Google Analytics Account Start off by going to Google Analytics and registering for an account as a website. Just enter whatever as a url, for example mygame.com. Add Google Analytics to your Project 1. Download GAForFlash from here: https://code.google.com/p/gaforflash/downloads/list [attachment=20695:GA_Download.jpg] 2. Copy the lib\analytics.swc file from the zip archive you just downloaded into your project's lib folder, then right-click it and select 'Add to Library'. [attachment=20696:GA_AddToLib.jpg] Start Tracking! 1. Connect to Google Analytics from your code as early as possible. You need to do this before doing any other tracking. (Tip: For my games, I connect during the preloader. I can then calculate how many visitors left during the preloader by comparing it to the number of people that reached the main menu.) [code]var tracker:AnalyticsTracker = new GATracker(DisplayObject, TrackingID, "AS3");[/code] DisplayObject is your highest level Flash Display Object. Typically you can just use 'this' from the place you are creating it. Tracking ID looks something like "UA-XXXXXXXX-X" and can be found for your site in Google Analytics under Admin -> Tracking Info. 2. Use pageviews to track the player's journey throughout your game. [code]tracker.trackPageview("/page");[/code] For page, make up something descriptive. Eg "/main_menu" or "/level_2_failed". I track:
- When the player reaches the main menu. By subtracting this from the number of players that connected, I know how many decided to leave during the preloader.
- Every time the player navigates to an important screen (eg upgrades, or credits). This shows you if players are finding their way to those important screens. If a screen is getting less attention that you would like it to, you may have to do something to make it more obvious.
- Every time the player starts a level. This will show you where players stop playing. It's natural for you to lose players between levels, but if you notice a sudden sharp dropoff, consider reworking the next level, maybe there's something you could improve.
- Every time the player wins or loses a level. This is useful for balancing difficulty. Levels that are too hard are a common cause of players leaving. Compare it to the 'player started a level' metric. Does the rate of players quitting your game match the rate of players losing levels? If yes, consider making those hard levels a little easier.
- Do you have any suggestions for interesting things to track? Leave a comment.
- All clicks on external links such as sponsor & developer logos. I also always specify on which screen it was clicked so I know which are most effective.
- How many players muted the music & sfx. I assume if a lot of players mute it, they don't like it or find it annoying.
- Tutorials and cinematics skipped.
- Anything else game specific that you can think of that you could use to improve your game, eg powerups used or upgrades bought.
- Do you have any ideas for important events to track? Leave a comment.