php script tracking number of clicks

by 10 replies
14
i want a redirect script to be able to tell me how many times it has been clicked on. i dont know what to search for or how to write the code.

i want to see if redirecting to my site or directly to product page makes a difference in the conversion rate.

this is the simple redirect code i use
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://mysitedotcom/courses/learn-more.php">
<TITLE>redirect to</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

what is the code to add to be able the see the number of clicks?
and if it's just a mater of adding more code how would i read the results, where would i see the number of clicks?

thanks for your help;
maryjane
#programming #clicks #number #php #script #tracking
  • you can set up Prosper202 and process your clicks through that script.
    • [ 1 ] Thanks
  • Check out google analytics if you haven't had a chance. The service is free, and easy to install. There are some extra code that you can add to your site to view different goals and conversions.

    I can help you set it up on your website if you need it as well, depending on what you're tracking etc.
  • Open Notepad (or any plain text editor) and save this as clicks.php (change "xxxxxxxxxx" to your real URL you want to redirect to):

    <?php
    $x=file_get_contents('clicks.txt');
    if ($x) { $x++; } else { $x=1; }
    file_put_contents('clicks.txt',$x);
    header("Location: xxxxxxxxxx");
    ?>

    Now also save a blank text file called clicks.txt

    Upload both to any domain. Send traffic to the clicks.php script, check the clicks.txt file for the click count.

    If it doesn't work you'll need to change the file permissions of clicks.txt to 666 (Google "Filezilla", download and install it, FTP to the place where clicks.txt is, right click it and choose "file permissions" and set it to 666).

    Or just use a clicktracker :-)
    • [ 3 ] Thanks
    • [3] replies
    • This is one of the best sample instructions I've seen on this forum - simple and straight to the point. It works like a dream.

      Thanks for the code.
      • [1] reply
    • You...are...awesome! Youve got a great mind for it!I'm really lucky to read your post. This piece of info really courage me. Thanks.
      • [1] reply
    • Very Nice ! Thanks for contributing a very helpful piece of code. I will be testing this out.
  • user SERVER array to check from where it is redirecting to ur site and then just add them to database
  • cant use google analytics. SERVER array is a bit over my head. Prosper202 looks pretty good and so does nevadasoft explanation.

    thank you everyone for your help.

Next Topics on Trending Feed

  • 14

    i want a redirect script to be able to tell me how many times it has been clicked on. i dont know what to search for or how to write the code. i want to see if redirecting to my site or directly to product page makes a difference in the conversion rate.