Tracking your users with Ajax, PHP and MySQL

5
  • 16 favourites

Index

Stats

12,241 visits, 34,188 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

What this tutorial is

A quick, simple and dirty way of tracking the users of your project with one simple event in Construct. It assumes you have access to a MySQL database (most hosts provide those now), phpMyAdmin or some other interface to MySQL as well as a web server where you can ftp and run .php files.

If you don't have your own web hosting I strongly recommend you get one. Hosts like GoDaddy provide everything you need for (currently) less than $10.00 US per month.

What this tutorial is not:

Instructions on how to use MySQL, phpMyAdmin or any other MySQL interfaces or how to write scripts in PHP. For the purposes of this tutorial, it's assumed you'll be using phpMyAdmin.

What you'll need:

Your own web host with access to a MySQL interface like phpMyAdmin.

A way to FTP files up to your web host.

A web host running PHP 5.0.0 or higher.

C2 (of course)

If you haven't already created a MySQL database with your host's control panel, you'll need to do so. Make sure that it's set to allow outside access. Some hosts default to only allowing the database to be accessed from your domain. It may warn you this is a security risk but it's not like you're keeping national secrets. Also, make note of the username and password you created, you'll need those.

The rest will be handled by this tutorial.

What you should end up with:

A searchable MySQL database that tracks usage of your game/app and provides you with data like: what version they're using, their IP Address (handy for knowing what country your users are from), the date and time they started your game/app (useful for tracking daily, weekly, monthly usage), and more.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • I have GoDaddy to host my website..

    Is it possible to create a BLANK MySQL database, then just copy it when I have a new user?

    I want each user to have their own MySQL database to save ALOT of data in.

  • Thanks a lot - VERY helpful! :)

    Just to note that lines 2-5 in your MySQL codearen't recognized as correct SQL code.

    Are they important? can you update how should they look now?