Current as of March 2003 

Introduction Title

       In the following study, we review how to make or build a simple and easy, automatic JavaScript Web site free page visits, image or link hit counter. Program tutorial and Internet Script lesson  includes the complete source code to each application . Automatically e-mail yourself and track the count and hits of your visitors, hidden (NO MAILING PROGRAMS POPPING UP ) and without having to program advanced HTML, Perl, cgi or any level of Java or Visual Basic (VB).

       We include instructions and an example of the simplest  No Mailto, and Eliminate (Prevent) Popup Alert  (but still email the Website visitor results to yourself) method. You must at least, however, have a basic knowledge of Input Forms (FORM ACTION and POST) applications.

       We describe in this exercise how to record the number of hits visiting a PageFile, or surfer clicking an ImageFile located on your site's domain.

Free Juno Email and Internet Connection Banner      Free Scripts      Car Truck Advertising Banner

       The objective of this tutorial is to allow you to count the amount of visits or object clicks but without having to download a free hit counter application from a second party who then sends you the results.

       THE FIRST JavaScript (default) in this tutorial shows you how to make and install the Visitor Counter source code into any one of your Web pages, but the user's email client will usually appear when applied.

       THE SECOND of these JavaScripts (Secured Server) in this easy lesson emails you each and every time someone hits your targeted page, but it's hidden and does not employ the MAILTO: code, and normally shouldn't bring up the viewer's e-mail client (program).

       THE THIRD (and by far the most popular of these applications) lets you know how many times someone clicks on a text link or an image that takes the user to another file or an outside Web site. Easy to build.

       First, however, check to see if the server on which your site is hosted supplies a cgi or Perl Counter Script. If they do, simply write or phone your server's tech support, and ask how to install it.

       If, to record the visits to your Website, you use a default Form Action Post Script (Non-Secured), there are a number of browsers, because of their internal Security Setting, that will pop up alerts to the affect that some type of information is being forwarded without the advantage of a security zone.

Early Microsoft Internet Explorer Wording of the Popup Alert:

"You are about to send informaton to the Internet zone.
It might be possible for other people to see what you are sending.
Do you want to continue?"

Popup Alert from Microsoft Internet Explorer, version 4.72:

Microsoft Internet Explorer Security Alert Example

Popup Alert from Netscape, version 4.6:

Netscape Security Alert Example

To Find More Information On This Subject, Visit
AOL  Google  MSN  Yahoo  Altavista  HotBot  Ask Jeeves or Lycos 


       This first simple application stands a good chance of allowing a popup alert (as displayed and described above) to appear. Nevertheless, if you want to record the hits, and desire to let your visitor know that he or she is being redirected, first place the following Script into the head section.

<Script Language="JavaScript">
function SendOne()

       You must then insert the words onload="SendOne" inside the body tag <body onload="SendOne()"> This activates the automatic emailing and sends the visitor to the final destination.

       You can change the SendOne and/or EmailMe to anything you like, but they must be repeated (Case Sensitive) in their proper places within the body tag and the Form in any of your selected Web pages.

       You'll then need to include the following Form header tag. Check the server that your domain is on, and make sure you use its default cgi or Perl Form method.

 <FORM ACTION="/cgi-bin/" METHOD="POST" name="EmailMe">

       The above is a standard example but must contain the words name="EmailMe" for the present simple Script to work properly.

       Now add the following to email you the Website results automatically:
<input type=hidden name="recipient" value="YourEmailAddress.Com">

       Add the </Form> tag, and you're finished.

       Basically, this is all you need to count the visits to your Web site. But remember the above-illustrated popup alerts. If the viewer does not click "Yes" in Internet Explorer, or "Continue" in a Netscape Browser, he or she might be transferred back to the preveious Website and never actually arrive at yours.

       Odds are highly against this, however, as the mailer simply would not function, allowing the visitor to remain at your location. But I just thought I'd mention it, anyway.

       And if the surfer clicks "Yes," your server will probably send him to a default "Your Email Was Sent Successfully" Confirmation Page. You must therefore include a Redirect Tag in the Form, which, as your domain is entered and the "yes" is clicked, will immediately transfer the viewer to an exact duplicate of your intended page. This will eliminate visits to the automatic Confirmation Page. A typical example is given below:

<input type = hidden name = "redirect" value = "">

And don't forget to include the
</Form> tag,
which must appear somewhere after the entire FORM ACTION container.

       The above redirect application sends your visitor automatically to an identical target page, but one without automatic e-mailer Scripting.

        Click Here  to view and access a copy-paste version of the above Basic Script in an almost ready-to-use Web page format. You'll only have to make some minor changes.


       Before you actually employ this JavaScript routine online to count your Web site visits, you have to type the words onload="SendOne()" inside of the body tag, and make certain you've typed the words name="EmailMe" inside your FORM's container (header line or tag. See the above FORM ACTION tag)

       If you want to be sure your Free Web Page Hit Counter is working properly, include a hidden Subject Tag in the Form container, such as:

<input type=hidden name="subject" value="This e-mail message was sent to me from my Internet site"> This message will appear in the Subject line of your email client (a program such as JUNO or Outlook Express).


       Bear in mind that if your site is receiving hundreds or thousands of hits per day, you might inadvertently cause a spam or an e-mail overload on your server. This, for several reasons, could get your Website kicked off line. Therefore, the best way to test the Script is to let it run for only a day or two, elimiate the mailer, upload the original file, and be satisfied with the knowledge of your current on line status.

       For this lesson (routine), your Web site must have the Secured Server permission. If you're not exactly sure what this is, or if you already have it enabled but don't know it, contact your site's host or tech support for confirmation of either.

       The following example is the same as the FIRST PAGE HIT COUNTER SOURCE CODE in this tutorial, but it should prevent pop up alerts. The one major difference, however, is that it incorporates the Security status.

You must close all relative spaces in all of the below tags, and don't forget to place the JavaScript Code in the <Head> section, and the onload="SendOne" in the body tag.

Notice the "s" after the http.

The "s" signifies Secured Server, which should not activate any popup alerts, as there is no information being transferred insecurely to the Internet zone. This is the "Hidden Factor" of this Web Page Visitor Hit Counter Script. You should also double-check the text scripting in your hidden tags, with the default tags offered by your Web host.

<FORM ACTION = " / YourDomainName-no-DotCom / cgi-bin /" METHOD = "POST" name = "EmailMe">

<input type = hidden name = "recipient" value = "YourEmailAddress.Com">

<input type = hidden name = "redirect" value = " / YourDomain / IdenticalButTargetedPage.html">

<input type = hidden name = "subject" value = "This was sent to me automatically">


        Click Here  to view and access a copy-paste version of the above Secured Server Script in an almost ready-to-use Web page format. You'll also have to make some changes.


       In this procedure (also Web site security oriented), you don't have to build anything into the head section or the body tag, but the FORM CONTAINER must wrap the HTML Button or the image button.


<FORM ACTION = " / YourDomainName-no-DotCom / cgi-bin /" METHOD = "POST" name = "EmailMe">

<input type = hidden name = "recipient" value = "YourEmailAddress.Com">

<input type = hidden name = "redirect" value = " / YourDomain / TargetedPage.html">

<input type = hidden name = "subject" value = "This was sent to me automatically">

<input type="submit" value="HTML Button"> which should look like the following, but enter your own value=" ":    HTML Button


       If you use a (SUBMIT) IMAGE TAG, just as the above illustration points out, IT MUST BE LOCATED INSIDE THE FORM:

<input type="image" src="images/button.gif"> which should look like the following, but your own design:    
Button Image

       Remember to include the </Form> at the end of the scripting.

        Click Here  to view and access a copy-paste version of the above (BUTTON) Secured Server Script in a nearly ready-to-use Web page format. You'll have to be aware of several important changes.

       Now, whenever your Website visitor clicks on either type of button, the click will generate and send an e-mail to you to that effect. Count the number of special email messages you receive, and always remember to include an identifying Subject Line in your form's script, which notifies you as to which object in your Web presentation is being clicked.

       The nice part of all the above easy & simple how to make a free Web site hit counter tutorial is that you didn't have to know or be familiar with advanced HTML, Perl, Visual Basic (VB), cgi or Java.

       No further lesson required, but it might be a good idea to Bookmark This Page. You might share it with others or someday be advancing to more and higher enterprising levels in the business of Internet scripting.

Get the latest version of
Internet Explorer or the newest Netscape Browser

To Find More Information On This Subject, Visit
AOL  Google  MSN  Yahoo  Altavista  HotBot  Ask Jeeves or Lycos 

 Thank you for your visit 

 Send Us Your Evaluation On This Lesson