Google Analytics Plugin
This is a documentation page of the Google Analytics plugin for Construct 2. You may download the plugin here. Also a sample project is available.
Tracking ID
First thing you need to do is setup a Tracking ID for your game which you may obtain from your google analytics admin page. You should copy it into Google Analytics Object's Tracking ID field. A Tracking ID should look like this: UA-XXXXXXX-X.
This ID is associated with your google analytics property. You should setup an individual property for each of your games. You will need to configure the property as a web site, and one needs to enter Site URL to do that. The actual game location may differ from the site URL. The analytics should work fine from any location on the web.
Analytics Data
Basically, you could stop here. You will get the demographics and session duration data provided you entered the correct tracking id. But if you need some custom data, such as event counters and timing, you may use Google Analytics Object's actions.
Custom Events
For tracking custom events, you can use the Track Event action. Setup the following parameters of the action:
- Cateogry - a category for your event, e.g. "GamePlay"
- Name - a name for your event, e.g. "PowerUp Use"
Google provides additional optional parameters for events. If you want to send these too, you may use the Track Extended Event action. It has two additional parameters:
- Label - a label for your event, e.g. "fireball"
- Value - a numerical value, associated with your event
Timings
Timings are used to track the duration of an event or process in your game. It could be the time a player spends on a particular level, or the time he spends in upgrade window etc. To track timings you should use two actions: Start Tracking Duration and Stop Tracking Duration. Both actions take the same parameters:
- Cateogry - a category for your time tracking, e.g. "GamePlay"
- Name - a name for your time tracking, e.g. "Level1"
Make sure each Start Tracking Duration is followed by Stop Tracking Duration with the same parameters, otherwise your timings won't be registered correctly.
Conclusion
I hope you will find my plugin useful. Here are the links again: