Jump to content

How many times has my game been played?


harrywatson
 Share

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???

 

?

Link to comment
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 :)

Link to comment
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..

Link to comment
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.
Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...