harrywatson

How many times has my game been played?

Recommended Posts

Anyone know of a nice wee script that will show if your game has been played?

 

Plenty of click counters out there which simply show how many times the link to the game has been clicked.

 

a href I think they call it. But that will just show you've clicked on the 'intention' to play the game, not that you

actually played it.

 

I've found a couple of php routines which might work,

here is one of them.

 

http://www.developingwebs.net/phpclass/hitcounter.php

 

At the moment I'm thinking about an event listener toward the end of the game?

Has Someone Played The Game???

 

?

Share this post


Link to post
Share on other sites

Hey thanks ericjbasti, 

 

I do use the good 'ol analytics. Still seeking a method for 'on the page' feedback.

 

I guess if you can tell a player what their score was you could post on the page

that the game was played. Umm haven't tried the php script yet. Real life getting

in the way.     If I find a good answer I'll post it here.  Many  Regards :)

Share this post


Link to post
Share on other sites

ok so far I've made a php file 'count.php'

<?php$count_my_game = ("count.txt");$hits = file($count_my_game);$hits[0]++;$fp = fopen($count_my_game, "w");fputs($fp, "$hits[0]");fclose($fp);echo $hits[0];?>

and a text file 'count.txt' with nothing in it.

I've uploaded both to the same directory

as my game and I changed 'index.html'

to 'index.php'. Then in 'index.php'

I used an include...

<p style="text-align: center;">Zombie Missions: <?php include("count.php");?>

Works beautifully every time the page is loaded and it increments just like it was told to do.

 

All I need now, is to get it to increment when all the zombies have been shot?

So I've got to stick the php include INSIDE an event listener within the game ?

I'll keep working on it, meanwhile any insights appreciated..

Share this post


Link to post
Share on other sites

Increment by an action would require you to use a javascript api to call your php script.

You have basically two ways to do it: using a XmlHttpRequest pointing to your php script. Or even more easier instancing an Image object to the desired url (no need to use the image).

(new Image).src = "count.php";
Note : Would be great in this case to generate 1x1 white image.

Share this post


Link to post
Share on other sites

You could learn about the Google Analytics API and create custom events. This way not only would you know if people are playing, you could track how far they get and what they do.

 

Yeah this is a great route as it's easy to include the basic get going code and the API isn't hard at all to add custom events, etc.

That and the amount of information you get is awesome and it's FREE! Personally this will be the way I go.

Share this post


Link to post
Share on other sites

Don't forget Flurry Analytics - super easy to implement and it tracks sessions and custom events.

 

 

does flurry work on a browser game?

 

Hi guys,
 
I'm trying to implement Flurry in my games but it not seem to be working.
Please could you help me?
 
I create the application in Flurry and get the API KEY.
After I put this two lines of code in the head section of my game index.html:
 
<script src="https://cdn.flurry.com/js/flurry.js"></script><script>FlurryAgent.startSession("MY_API_KEY_HERE");</script>

I'm doing it right?

I put it in the wrong place?

I need to do anything else?

 

Thanks for all,

Cheers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.