2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 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.

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
outandouter says

Now this is cool! great work…

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 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.

3752 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Located in Spain
  • Has sold $125,000+ on Envato Market
  • Helped several times protecting Envato Market against copyright violations
+9 more
pezflash says

Nice share! Thank you Phoenix.

9 posts
  • Has sold $100+ on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 1 year
  • Located in 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
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
  • Made it to the Authors' Hall of Fame
+3 more
yuanhao_viva says

thanks man,really useful

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by