mirror of https://github.com/tildeclub/site.git
Revise page counter tutorial with new details
This commit is contained in:
parent
1b7ed9a4b2
commit
abd01981a2
|
@ -1,57 +1,45 @@
|
||||||
---
|
---
|
||||||
title: Adding a web counter to your page
|
title: Page Counter (counter.tilde.club)
|
||||||
author: deepend
|
author: deepend
|
||||||
category: tutorials
|
category: software
|
||||||
---
|
---
|
||||||
|
|
||||||
To display a visit counter on your webpage, you'll need to edit your `index.html` file and insert a `<script>` tag that loads the counter.
|
Image-digit hit counter for your tilde page. Drops in with one `<script>` tag and increments on each load.
|
||||||
|
|
||||||
Type: `nano index.html` to open your file for editing.
|
## Quick start
|
||||||
|
|
||||||
Add the following line *exactly where you want the counter to appear*:
|
Put this where you want the digits to render (footer is common):
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://counter.tilde.club/?page=homepage&user=yourname&style=57chevy"></script>
|
<script src="https://counter.tilde.club/?page=home&user=<your_username>"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
- Replace `homepage` with any identifier for the page you're tracking.
|
## What to know
|
||||||
- Replace `yourname` with your username or something unique to your site.
|
|
||||||
- Replace `57chevy` with a different style if you'd like.
|
|
||||||
|
|
||||||
Here’s an example:
|
* Counts are keyed by **(page, user)**. Use a unique `page` per page (`home`, `about`, `guestbook`).
|
||||||
|
* Digits are **zero-padded to 4** (e.g., `0042`).
|
||||||
|
* **Counts every load** (not unique visitors).
|
||||||
|
* Requires **JavaScript**.
|
||||||
|
|
||||||
|
## URL parameters
|
||||||
|
|
||||||
|
* `page` (required): letters/numbers/`._-` only.
|
||||||
|
* `user` (required): your tilde username (no `~`).
|
||||||
|
* `style` (optional): digit theme (default `web1`).
|
||||||
|
* `ext` (optional): image extension (default `gif`).
|
||||||
|
|
||||||
|
Example with options:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<p>Visitor count:
|
<script src="https://counter.tilde.club/?page=about&user=<your_username>&style=7seg&ext=gif"></script>
|
||||||
<script src="https://counter.tilde.club/?page=homepage&user=alice&style=web1"></script>
|
|
||||||
</p>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you’ve added the line, save and close the file using `CTRL+X`, then press `y` and `[Enter]`.
|
## Available styles
|
||||||
|
|
||||||
Refresh your site in your browser to see the counter.
|
`57chevy`, `7seg`, `bbldotg`, `bellbtm`, `blgrv`, `cntdwn`, `computer`, `ds9`, `fdb`, `led`, `marsil`, `sbgs`, `web1`
|
||||||
|
|
||||||
### Available Styles
|
## Troubleshooting
|
||||||
|
|
||||||
You can use any of these style names in the `style=` parameter:
|
* **No digits**: open the script URL directly—fix invalid `page/user` or typos.
|
||||||
|
* **Broken images**: ensure `style` exists and `ext=gif`.
|
||||||
- `57chevy`
|
* **Shared counts**: give each page a distinct `page` value.
|
||||||
- `7seg`
|
|
||||||
- `bbldotg`
|
|
||||||
- `bellbtm`
|
|
||||||
- `blgrv`
|
|
||||||
- `cntdwn`
|
|
||||||
- `computer`
|
|
||||||
- `ds9`
|
|
||||||
- `fdb`
|
|
||||||
- `led`
|
|
||||||
- `links`
|
|
||||||
- `marsil`
|
|
||||||
- `sbgs`
|
|
||||||
- `web1`
|
|
||||||
|
|
||||||
Try different styles to see which one fits your site best.
|
|
||||||
|
|
||||||
Note: The counter uses sessions and cookies to count *unique* visits per user every 24 hours (or whatever time is configured). Page refreshes won’t increase the count unless unique mode is off.
|
|
||||||
|
|
||||||
If you need help or want a custom style added, reach out to the site admin.
|
|
||||||
```
|
|
||||||
|
|
Loading…
Reference in New Issue