OpenAnalytics
Purpose
This plugin allows a server owner to track various server statistics via Google Analytics. It uses the Google Measurement Protocol to do so reporting information such as logins, quits and kicks. It also tracks which worlds players are playing in as page views. Recently added is tracking of SignShop transactions via Google Analytics e-commerce hits and submission of player IP address allowing anonymous tracking of geographical player distribution.
Commands
This plugin provides commands for admins to use in configuring the plugin.
- /analytics admin set tracking-id UA-XXXXXXXX-Y
- /analytics admin set host-name server.com
- /analytics admin set use-metrics <true|false>
Additionally, the plugin allows a player (or staff member on the players behalf) to opt out/in of tracking. This is required in accordance with the Google Analytics Measurement Protocol Policy.
- /analytics optout
- /analytics optin
- /analytics optout <playername>
- /analytics optin <playername>
Note that setting another player as opt out/in is available via a permission node and should only be given to staff members to help out players.
Permissions
Permissions are provided as follows:
- openanalytics.optout - Provides access to the optout and optin subcommands.
- openanalytics.optout.others - Allows you to opt out/in other players.
- openanalytics.admin - Provides access to the admin subcommand.
How to Install
Download the jar file. Place it in your plugins directory and restart your server or use plugman to load. Then shutdown your server or unload the plugin, open up config.yml and add your Google Analytics tracking-id and server host-name. Restart your server and you should be able to see tracking information flowing through to Google Analytics.
Alternatively you can configure the tracking-id and host-name via the in game commands. After setting these values in game, the plugin should automatically restart tracking with these changes.
It is recommended to create separate Google Analytics web property for your in-game statistics then you might use for your regular server website. However, this web property can (and probably is best) housed within the same Google Analytics account.
This plugin will work with Java 1.6+.
Development Builds
Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk. They can be found here: http://ci.pjt.me/job/OpenAnalytics
Planned Features
The following features are being considered for addition.
- Tracking the visiting of Residences as page views
- Tracking commands run as event hits
- And probably more as I dream things up
If you have any ideas, please let me know.
Player Anonymity
In accordance with the Google Analytics Measurement Protocol Policy, all data submitted must not be trackable by Google back to a specific person. As such, players are assigned a random id. This is used as the "Client ID" that is reported to Google, providing the appropriate level of anonymity.
Known Bugs
None at this time.
Plugin Metrics
This plugin utilises Hidendra's plugin metrics system, which means that the following information is collected and sent to mcstats.org:
- A unique identifier
- The server's version of Java
- Whether the server is in offline or online mode
- The plugin's version
- The server's version
- The OS version/name and architecture
- The core count for the CPU
- The number of players online
- The Metrics version
Opting out of this service can be done by editing plugins/Plugin Metrics/config.yml and changing opt-out to true. Alternatively, this plugin alone can be opted out by setting use-metrics to false either in the plugin's config.yml directly or via the in game command.
Credits
Please note that while this plugin is all my own code and I'd been thinking about this idea for a while, I was particularly inspired to write something recently after coming across the Google Analytics Plugin by Fox32. In particular I would like to thank him for very kindly sharing his code.
In the long run I decided to write my own for several reasons. First, this plugin uses a newer Google Analytics protocol that is part of the Universal Analytics offering from Google. Second, my brain went wild considering all the fun I could have coding this and attempting to cram the usage of a Minecraft onto what Google Analytics offers. And lastly, it was just fun.
Why
I like stats. I like to know things like how many players are playing on my server, I like to be able to look at that data historically, etc, etc, etc. I want to be able to see that information in a pretty format and slice and dice it. And as a long time computer geek and user of Google Analytics, I know that the interface is second to none. And I personally have no interest in coding such an interface. So, well, hence we have this plugin.
1.9 bug:
http://pastebin.com/BbiDdSUU
What am I supposed to use for the hostname? is it supposed to be my server's IP address?
Is there a command or something I can use to check that I've configured everything properly?
@mcly
Agreed. It's on my todo list (performance tuning) for when real life allows.
Oh, and for when we figure out where the world of minecraft is going. :)
Just to say Excellent work !!
I downloaded the latest DEV versions today
I have a Bungee set-up with 4 servers behind it each with multiple worlds seems to be working great.
For anyone interested in this, this is what I did. I got both files below from the DEV page.
Installed OpenAnalyticsBungee-1.1.01-SNAPSHOT.jar into the bungee plugins folder and restarted it.
Installed OpenAnalytics-1.1.01-SNAPSHOT.jar into each servers plugins folder and restarted them.
On each server I added my Tracking ID and host name as per the directions and the plugin just went to work sending my data to Google.
The real-time stuff in Google analytic s is not 100% accurate for me so far but im not to bothered about that.
Only thing for me on some of my servers I have the same world names so it would have been nice to see the pages seperated as per server instance.
/bungeeserver1/world/world /bungeeserver1/world/world_nether /bungeeserver2/world/world /bungeeserver2/world/world_nether
As a feature I would love to see a way to see how many times a client displayed my server in there personal list.
For instance in the bungee log it looks like this
13:30:07 [INFO] [/<clientip>:58335] <-> InitialHandler has connected
Thanks again for a great Utility, even the dev version for me right now is proving useful.
It needs to be tuned for performance/scalability.
FYI. The plugin works fine under 1.7.9. I will need to do an update sometime, however, to switch UUID before name changing is supported.
@Alphabravo9
I'd love to have the opportunity to performance tune this for larger load servers. PM sent. Thanks for your comment here.
Randomly freezes my server and java goes up to 600% from 100% (1 core). Removed it and problem solved (150 players server)
I finally got this to work! Any idea why on the real-time pages it sometimes says "server not responding"?
Update coming in the next 2-3 weeks to support 1.7.9.
Hey, just a suggestion, you might want to mention in the installation that you need Vault in order for it to run.
@godgodgodgo
You should see responses quite soon, practically in real time. I've got a lot going on tomorrow, but will be available this weekend to help. If you'd like help getting this setup, please send me a PM and I'd be glad to help.
Does this take a while to work? I've set up the hostname to my non SRV record in both the plugin and google analytics and I've also got the IDs correct I believe but the google analytics page says that no-one is online and keeps saying "Server not responding. Please wait..."
"HTTP Response Code 200" is shown in my server log after sending data.
@mig4ng
@Paktosan
Sorry, didn't see this for a few days. I admit I'm new to bungeecord. I'll do some research and get this sorted in the next version if possible.
@Paktosan
Quoted from Paktosan: "Hi, we are testing this currently in our Servers and really like this. The only Problems we have are not working metrics (disabled it via config) and sometimes it dont show our worlds connected with multiverse. But we wont use it in the future because it dont work good if the Server is behind a bungeecord. Is it possible to convert the Plugin so it can be used with bungee nativly?"
I completely agree with this!
Hi, we are testing this currently in our Servers and really like this. The only Problems we have are not working metrics (disabled it via config) and sometimes it dont show our worlds connected with multiverse. But we wont use it in the future because it dont work good if the Server is behind a bungeecord. Is it possible to convert the Plugin so it can be used with bungee nativly?
Greetings from Germany, Paktosan
@wesley023
Thanks @wesley023. I'm really glad you are enjoying it. Stay tuned for version 1.0.02 coming which resolves the problem of not properly tracking a user's IP address with Google Analytics. This is sorted now and well worth taking the update.
Also, if you've any suggestions please let me know. Perhaps there are plugins your server uses that could use some tracking via hooks or custom events?
Anyhow, feel free to drop me a note.
Awesome plugin!