Google Analytics
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.
Cocoon
At the moment Cocoon has no offical Analytics plugin, yet. But you can use the “Cordova Analytics” Plugin made by Cranberrygame.
[creativ_button url=”https://www.scirra.com/store/construct2-plugins/construct2-cordova-plugins-1662″ icon=”shopping-cart” label=”Cranberrygame – Cordova Plugins for C2″ colour=”green” colour_custom=”” size=”medium” edge=”straight” target=”_blank”]
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.
[code]cranberrygame_CordovaGoogleAnalytics_1.0.12[/code]
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.
[creativ_button url=”https://www.google.com/analytics/web” icon=”” label=”Google Analytics” colour=”orange” colour_custom=”” size=”medium” edge=”straight” target=”_blank”]
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.
[creativ_button url=”http://cocoon.io” icon=”user” label=”Cocoon.io Dashboard” colour=”blue” colour_custom=”” size=”medium” edge=”straight” target=”_blank”]
Then go to the “Plugins” tab and choose “Custom”. Enter there following Repo-URL.
https://github.com/danwilson/google-analytics-plugin.git
Please note, that the link above doesn’t work anymore with the latest Cocoon version. Please use this link instead.
[code]https://github.com/AndreasReitberger/google-analytics-plugin.git[/code]
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.