2566 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 200 and 499 users
+5 more
ThemeProvince says

Hey guys here’s an easy way to track your items using simple php and text files.

1. Create a text file. Call it no_of_hits.txt. Leave it empty.

2. Create a php file and call it counter.php.

3. Here is the php code i created. Place it in the counter.php. Follow the comments.


<?php // This gets the figure inside the text file.

$number_of _hits = file_get_contents("no_of_hits");

// We give our item a unique id

if ($_GET["id"] == 1) {

 $hits = $hits + 1; 

}

// We add the the new visitor hit.

$number_of_hits = $number_of_hits + 1;

// Open our document

$manage_hits = fopen("no_of_hits.txt", "w"); 

// Replace the old hit counter

fwrite($manage_hits, $hits); 

// Close and save the file.

fclose($manage_hits);

// Print our item's hits.

print "Your item has $hits hits";

?>

4. Save and upload to your server or host.

5. On your item page place an image tag at the bottom.


<img src="http://www.yourwebsite.com/counter.php?id=1" />

Get your item id that we defined earlier and replace with mine above. You can leave it at 1 if you want.

6. Sit back and enjoy. :)

Only when someone visits your item’s page will the counter activate. therefore refreshing on the exact location of php doc wont increase the number of hits.

2566 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 200 and 499 users
+5 more
ThemeProvince says

EDIT : replace

$number_of _hits = file_get_contents(“no_of_hits”);

with

$number_of_hits = file_get_contents(“no_of_hits.txt”);

767 posts
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
outandouter says

Now this is cool! great work…

2566 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 200 and 499 users
+5 more
ThemeProvince says

The top post has some errors… but this is a working version…

Download the source code here:

Click here to download a working version.

Click here to see a live example currently tracking my item.

3747 posts
  • Won a Competition
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
  • Spain
  • Referred between 200 and 499 users
+5 more
pezflash says

Nice share! Thank you Phoenix.

9 posts
  • Exclusive Author
  • Has been a member for 1-2 years
  • Sold between 100 and 1 000 dollars
  • Netherlands
F4LLCON says

Does this still work? I am trying a similar thing, but it does not load it? I have an googleanalytics.html on the server, a pageloader.php that loads the .html file, and then I am using <img src=”http://website.com/pageloader.php” />.

When I directly go to the site http://website.com/pageloader.php, analytics confirms I am on it, but when I go on my profile on 3DOCEAN, it does not show I am on the profile.

Did 3DOCEAN fix this or am I doing something wrong?

66 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • Has been a member for 3-4 years
  • China
yuanhao_viva says

thanks man,really useful

by
by
by
by
by
by