Google Analytics helps you to track your user behaviors in your game. This will deliver data for improving your game to fit the users needs.
At the moment Cocoon has no offical Analytics plugin, yet. But you can use the “Cordova Analytics” Plugin made by Cranberrygame.Cranberrygame - Cordova Plugins for C2
Install the Plugin
Once you own a license for the Cordova Plugin package by cranberrygame, unzip it and go to the …\12_Cordova_extension_analytics\… folder and drag’n’drop following file into Construct 2.
Then a little window pops up. Click Install.
Restart Construct 2, then the plugin can be used.
Construct 2 Code
Now you can import the plugin into your Construct 2 project.
The plugin overs two actions.
- Track Screen (for the current screen like “settings”, “game” and so on)
- Track Event (for tracking, for instance what button gets pressed and so on)
So you can create a global event sheet and a function in order to track your events and screens, or you add a tracking action to each event (I recommend to use a function). We will provide an example file soon.
Google Analytics Tracking ID
Login to your Google Analytics account over here.Google Analytics
Then go to the “Manage” tab and create a new property.
After that, select “Mobile App” and enter the needed information like the app name.
Click on Create ID in order to get your ID. Copy your ID from here and insert it at the Cordova GoogleAnalytics Plugin.
For that, just select the plugin in your Construct 2 project.
Install the plugin in Cocoon
Please visit your Cocoon Dashboard and select your project.Cocoon.io Dashboard
Then go to the “Plugins” tab and choose “Custom”. Enter there following Repo-URL.
Please note, that the link above doesn’t work anymore with the latest Cocoon version. Please use this link instead.
and click Install. (Don’t forget to save then!)
Build your game and you’re done! Google Analytics will show the first data in the next few hours.