Learn-Write-Repeat / Learn-Write-Repeat.github.io

Organisation Website
https://contribute.devincept.com/
0 stars 8 forks source link

Page counter #10

Closed arpit-dwivedi closed 3 years ago

arpit-dwivedi commented 4 years ago

Explain steps to implement both types of counters implemented in the example file yesterday.

share the links and coding part with an example here.

reddymahendra52 commented 4 years ago

First Counter

  1. In the first counter I used Count API its a free API which increases the counter every time a page is reloaded or opened.
  2. In order to create the counter we have to generate a unique key that key can be your name, site name or anything but it should be unique.
  3. You type the unique key in the panel it will generate the code Capture
  4. I used the name devIncept it generated the following code below.
      <script>
        function cb(response) {
            document.getElementById('visits').innerText = response.value;
        }
    </script>
    <script async src="https://api.countapi.xyz/hit/devIncept/visits?callback=cb"></script>
  5. You can paste the code in the body
  6. I created a div inside which I created a p element with id=visits and applied it.
  7. And tried to style it.

    Second Counter

  8. For the second counter I used Freehitcounter
  9. There are very few options to select from.
  10. The main advantage is it shows the no of unique visitors to the site
  11. You select from the options and it will generate the code
    <script type="text/javascript" src="https://freehitcounters.org/count/7kc9"></script><br>
              <a href='https://www.horando.de/'>bei Horando bestellen</a>
              <script type='text/javascript'
                  src='https://www.whomania.com/ctr?id=37ed85dcb7ee3519b7ba271353497f62434e701a'></script>
  12. Paste the code where you want.
  13. The main problem is we cannot style it according to our wish
kevinli15 commented 3 years ago

For freehitcounter, is there a way to view the counter without changing it?

reddymahendra52 commented 3 years ago

@kevinli15 I didn't really get your question. Can you please explain what you are trying to ask??

kevinli15 commented 3 years ago

On some blog sites before you click on an article to read it will show you a preview of the article and how many views it already has. I was wondering how to display the views without visiting the page and updating the view count. In other words I want to see the view count but dont want to update it yet since I havent actually clicked on the article to view it. Thank you for the response