Support for Playtomic analytics in Corona SDK

Hey guys, I ported the HTML5 client for Playtomic to Lua, and worked with Playtomic to get it to be officially supported by them. If you haven’t heard of it, Playtomic is an analytics service that has a bunch of cool features.

For those who need it, I wrote a short intro to analytics, and why they are important in this blog post.
Everyone else can jump straight to this interactive Playtomic test suite for Corona SDK on github.

If you have any questions about Playtomic, I think the playtomic guys will answer them on this thread. (A cool bonus of having the client officially supported!)

I hope this helps some other devs out, it’s been very useful for us :slight_smile:

-Angelo

[import]uid: 12822 topic_id: 20295 reply_id: 320295[/import]

hi guys, feel free to give Angelo’s plugin a spin. I’ll try my best to provide tech support [import]uid: 97745 topic_id: 20295 reply_id: 79314[/import]

Playtomic looks very cool. Thanks for doing the heavy lifting, Angelo. I’ll try to wire this up in my own game.

@Angelo - I’m curious what is missing and/or broken with Corona’s implementation of Flurry that made you want to get this working? [import]uid: 9422 topic_id: 20295 reply_id: 79347[/import]

This looks very cool - thanks so much for sharing!

Peach :slight_smile: [import]uid: 52491 topic_id: 20295 reply_id: 79368[/import]

@XenonBL Originally I was using Flurry, but the stats didn’t update very fast, and they didn’t seem right. So I started keeping track of things with my own solution and I saw that the stats were very different from what I saw in flurry’s console. I was only collecting session information though, and I was looking into letting players create their own levels, so I wanted to see if there was already a solution out there that I could use. A friend of mine who makes flash games recommended playtomic, which was perfect because in addition to handling events they also support user generated levels with nice features like rating and fetching top lists. So now all I have to do is finish writing the in game level building interface :slight_smile:
-Angelo [import]uid: 12822 topic_id: 20295 reply_id: 79446[/import]

i just added some cool analytics code into Jon + Biffy Beebe’s extremely popular Ghost vs Monsters code

check it out here
https://github.com/chongf/Ghost-vs-Monsters-Playtomic

the live public data is here
http://playtomic.com/stats/5241-ghosts-vs-monsters-coronasdk

basic metrics tracked

  • Views/Plays ( including playtime )
  • Open Feint Button
  • Play Button
  • Wins, Losses (see which levels get the most wins/losses )
  • Heatmaps ( tracks the x,y coords when the Ghost lands/hits something ). Logging coordinates where things happen (eg: deaths ) can help troubleshoot levels.

advanced stuff

  • loading game variables from Playtomic’s servers
  • more to come [import]uid: 97745 topic_id: 20295 reply_id: 79739[/import]

It was pretty straight forward to get this working, especially since I had already wired up Flurry analytics. I have a couple newbie questions though:

  1. Since my game is intended to be cross platform for iOS and Android (and other flavors of Android such as Nook and Kindle Fire) I wasn’t sure which ‘API’ and ‘Platform’ options to select when adding a new game in the Playtomic dashboard. I ended up creating 3 separate game entries, for iPhone/iPod, iPad, and Android. Is that the way to go or should I have created just one game entry? There was also no ‘Corona’ option to select for API.

  2. After testing and playing for a while I noticed on the Playtomic dashboard that my game showed many ‘views’ but 0 plays. Not sure what the difference is between a view and a play, but is there something I need to do trigger a game is actually played? I saw 0 plays even after I successfully logged many wins and loses on various levels.

  3. For my custom metrics I noticed the dashboard shows totals that seem accurate, but ‘today’ and ‘average’ counts were all 0. How do I get an accurate count of ‘today’s’ custom metrics?

  4. Even after I deleted stats on a game with incorrectly named levels the old level stats still show up in the graphs. Is there a way to completely clear out old stats (short of deleting a game entry)?

  5. Curious how Playtomic makes money while offering their services for free. (I’m not complaining about free, I just don’t want them to go out of business if I’m using their service!)

Thanks again, Angelo and Ben, for setting this up and sharing it.

[import]uid: 9422 topic_id: 20295 reply_id: 79780[/import]

@XenonBL, to answer your questions

  1. We don’t officially have the CoronaSDK Segment yet, but you can check anything in the box (its just a tag that helps us track how many games run on what platform). I’ll get it done by Monday hopefully

  2. To log views, use Playtomic.Log.View(). To log plays, use Playtomic.Log.Play(). I’m writing up a Lua documentation, but in the meantime, you can refer to the HTML5 documentation because it’s very very similar. Link at http://playtomic.com/api/html5#Analytics

  3. Sometimes it takes a while to update the “today” and “average”, depending on server load. It’s actually a seperate piece of server code querying the main database, which explains a different numbers (sometimes). But you can definitely count on the “total” statistics. I just ran a test on Ghost vs Monsters (the Playtomic version) , seems that alls good.

  4. This interesting. Goto Settings->Metrics & Heatmaps, then uncheck the metrics that you don’t want to show. This just hides it from the dashboard, but there’s another problem - the game code from Corona still sends the metric to the servers (if someones playing the game), so you have to remove that piece of code too. After you’re sure this is done, then you can proceed to ‘Delete’ the metric in the same page (red button in Settings->Metrics & Heatmaps). I guess the best way to approach this, is to make a test Playtomic game first, run all the metrics there, tidy up the metric names and make a new Playtomic game.

  5. All API calls to our server are free. We’re rolling out some premium features soon ( where you pay so you get better looking dashboard with pinned notes, error logs, comparisons, etc ) [import]uid: 97745 topic_id: 20295 reply_id: 79813[/import]

Heatmaps aren’t working correctly for me. Sometimes they work and other times they don’t. I’d like to send the player position while in-game every few seconds. I tried forcing it to send and it still wouldn’t work. Also, are the freeze and unfreeze calls supported? So we can collect a whole bunch of data during the game, and then submit it once the player gets game over? [import]uid: 51654 topic_id: 20295 reply_id: 79815[/import]

you don’t actually need to force send, because the data will collect itself for about a minute before transmitting. Yes you can do freeze and unfreeze if you like.

what’s your game id (swfid)?

you can run the Ghost vs Monsters example at https://github.com/chongf/Ghost-vs-Monsters-Playtomic , the heatmap logging works fine (Corona’s terminal will show that the heatmap data is being sent ). It might not show the data immediately because it’s crunching the numbers to produce a nice heatmap, but the data’s there. Also, you have to supply a heatmap image with the size similar to that of your map. For eg if you"re making a 2d platformer with 1400px x 500 px maps, you have to find a way to get that map image and upload to Playtomic.

[import]uid: 97745 topic_id: 20295 reply_id: 79824[/import]

Here’s my ID:

5931

The heat maps work fine for tracking taps on the main menu, but I’m also trying to track “player position” and “deaths” while the user is playing the game.

I current have it set to send out heat map coordinates every 3 seconds. I can see in my terminal window that they are being sent successfully to your servers, but when I login, I can see the “main menu” heat map is updated perfectly, but the in-game heat map is not updated at all. [import]uid: 51654 topic_id: 20295 reply_id: 79830[/import]

@003naveen i pulled up your dashboard and saw that there’s a dot spectrum in the middle of the game screen, under the metric “playerposition”. You probably expected more dots all across the screen due to the airplane’s movement. ( I assume it’s a SHMUP type game with infinite vertical scrolling? )

Give it a couple hrs more to crunch some data

you can check the server status here http://playtomicstatus.apphb.com/ [import]uid: 97745 topic_id: 20295 reply_id: 79837[/import]

@bazookaBen

It still hasn’t shown up. Yeah, the game is a vertical shooter (all art is placeholder) and I’d like to know where the player is moving the player around the screen. It only shows the middle dot which is strange. I’m checking the coordinates in the terminal window, and it’s showing up properly. Not sure why only the middle shows :S

Also, the “deathposition” metric that I have doesn’t show up at all. I can verify that it’s being sent currently via the terminal window.

It’s really weird because the main menu metrics that I have work perfectly :confused:

Naveen [import]uid: 51654 topic_id: 20295 reply_id: 79916[/import]

@003naveen

can you send of one of the following:

  • your heatmap logs. Eg:

Playtomic: Send: http://ga2b1dd20c3e1481b.api.playtomic.com/tracker/q.aspx?swfid=5241&q=h/ghostLandingPosition/level1/504/251&url=ansca.corona.playtomic&0.21895918632809z

  • the development version of the game. I’ll try to look into the code, and see if there’re any hangups.
    bazookaben at playtomic dot com [import]uid: 97745 topic_id: 20295 reply_id: 80361[/import]

ok we found the heatmap problem. It was floating points (eg: 205.68 ) being sent to our server, and not parsed properly, and hence not showing in the heatmap images. Right now, we support round integers. Fix to come within 24 hours! [import]uid: 97745 topic_id: 20295 reply_id: 80631[/import]

First I have to say I this service is awesome! With results coming in within minutes, the variety of data collection and a developer presence in the Corona forums, I have no choice but to use this incredible service!

So I have gotten the level metrics to work. But now I am trying out the gameVars and have been encountering some problems.

I am using the ghosts vs monsters sample code and found the line in the level1.lua that was commented out. So I uncommented that and also added the gameVar called “CloudSpeed” in my playtomic game dashboard. When I run the program, it always produces this error in the terminal:

----
Playtomic: Status: 0, Code: 1, Message: General error, this typically means the player is unable to connect to the Playtomic servers
error loading gameVars
Playtomic: Invalid json in response: < h t m l > …
----

However during all this I have been able to submit the level metric data with no problems.
Again, great service and am looking forward to use it!

[import]uid: 94868 topic_id: 20295 reply_id: 80640[/import]

@Sceaming Leaf thanks! the gameVars aren’t working atm cos we’re migrating the api servers ( horrible windows servers to faster, nodeJS ones ). Should be done in a couple more days.

the Playtomic Test Suite at https://github.com/chongf/playtomic-lua-testsuite has all the tests needed to see what’s working and what’s not. I use that alot myself :smiley: [import]uid: 97745 topic_id: 20295 reply_id: 80653[/import]

@Angelo, thanks for that great work. I just implemented it in my games update easily.
[import]uid: 57744 topic_id: 20295 reply_id: 80800[/import]

Excellent, thanks for the response bazookaBen!
[import]uid: 94868 topic_id: 20295 reply_id: 80841[/import]

Another GameVars question.

I got it to work this past weekend and it continues to work with that specific game’s swfid,guid, and apikey.

However, when I made a new game in the playtomic dashboard I get the error when I try to access the GameVars from the Corona Simulator:

Playtomic: Status: 0, Code: 2, Message: Invalid game credentials. Make sure you use your SWFID and GUID from the API section in the dashboard.
error loading GameVars

I copied the game credentials directly from the API Setup, so I know they match what is listed there. I made another new game in the dashboard, used those credentials and I get the same error.

It just seems like every new game I create gets this error. [import]uid: 94868 topic_id: 20295 reply_id: 82464[/import]