Because Dreamwaver makes it so easy to work with HTML code and scripts, even if you're a novice Web designer, adding a hit counter to your Web page is not difficult to do. There are a couple ways to make a hit counter. The easiest way is to get code for a free hit counter tool from your Web host and paste it onto your Web page. A second way is to create a PHP Web page and use a PHP script. The PHP method is a little more complicated, but you don't have to be a programmer to get it to work.
- Skill level:
Other People Are Reading
Navigate to your Web host's home page and see if they offer free hit counters. If they don't, go to another Web host that does. Bravenet, for example, offers free hit counters and other Web tools even if you don't have a host account with them (see Resources).
Click the link to the hit counter tool. You may need to register with the Web host in order to download the code, but the registration should be free. If not, look elsewhere. Bravenet's hit counter is free.
Click the button to create a new hit counter. You will be prompted to enter a name for the counter and provide the URL of the page you want to add the counter to.
Choose settings and then the look for your counter.
Open Dreamweaver and open the Web page you want to add the hit counter to.
View the HTML code for your page by clicking the "CODE" button at the top of the window, then click at the location where you want the counter to appear. Usually counters are placed at the bottom of the page above the closing "BODY" tag.
Select "Paste" from the Edit menu and the code for the hit counter will be inserted. Save changes, upload the page to your Web server and view it in your Web browser to test.
Use your Web browser to download a free PHP hit counter script from the Internet, such as the one at phpjunkyard.com (see Resources).
Go into your site in Dreamweaver and create a new folder in your local files list called "counter."
Place the PHP script and any files that came with it in this folder and read the instructions that come with the script for any special customisation steps you need to take. Sometimes this information is on the Web page before you download, or it's a "readme" file included in the download.
Open the hit counter PHP file in Dreamweaver. Change to "CODE" view if necessary. There should be very clear instructions from the programmer at the top of the file about what variables you need to customise.
Make any necessary changes to the PHP code following the programmer's instructions. Save and close the file.
Open the Web page you want to add the counter to and save it with the extension .php instead of htm or .html. To run PHP on your page, you need this file extension or the commands will be ignored. View the HTML code on this file.
Add a link back to the programmer's website under the counter (it's the considerate thing to do if you're using someone else's script for free), save changes to the file, then upload the php Web page and the counter folder to your Web server.
View the files on your Web server in Dreamweaver by selecting "Remote Site" from the top of the site files box on the right. If the instructions for your hit counter script say to change file permissions on any of the script files, right-click the file name and choose "Set Permissions" from the pop-up menu.
Make the changes to the "Set Permissions" screen and click "OK."
Return to "Local View" in your site files list and double-check the Web page that will have the hit counter to make sure you have the PHP command correct, then save, upload the file to the server and use your Web browser to view the page and test the hit counter.
Tips and warnings
- There are free hit counter service companies that offer code to copy and paste to your Web pages (like the Web-hosting example above). However, if the company goes out of business, the service will end. Because Web-hosting companies offer many services (not just hit counters), they tend to stay in business longer.
- You can also use a Perl CGI script for a hit counter. They work similarly to the PHP script mentioned here, and are free to download on the Internet.
- Free hit counters from Web hosts may include graphics advertising the host company, but that's a small concession for something you're getting for free.
- Using a PHP hit counter will only work if your Web server has PHP installed. Most Web-hosting companies do, but Internet service providers that give you a free Web account as part of your connection package may not.
- When using the PHP script, you may need to update some links on your site since the name of your Web page will change when you add the .php extension to the file name.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for