Tracking your users with Ajax, PHP and MySQL

5

Index

Stats

13,314 visits, 36,503 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.

Published on 27 Nov, 2015. Last updated 19 Feb, 2019

Setting up Ajax with Construct

This... is the easy part. Well, sorta.

In your construct project, insert a new object and select the Ajax object.

On one of your event sheets, like in the System On start of layout, add a new action and select Ajax Post to URL. If you want to know if the Ajax post went ok, add a tag, otherwise, it's not needed. In the URL text box, enter the url to the tracking.php script you uploaded. It should look like this: "http://www.myurl.com/tracking.php"

Next, in the Data box, enter this: ""PV="&URLEncode(projectversion) & "&N="&URLEncode(projectname)"

This builds a string of data to be sent to the .php file. It includes the project version (PV) and the name of your project (N). The URLEncode makes sure it can be sent across the web properly.

And finally, in the Method box, put in: "POST:

And, hopefully, you're finished.

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