ihucos / counter.dev

Web Analytics made simple
https://counter.dev
GNU Affero General Public License v3.0
914 stars 39 forks source link

Add the ability to test on localhost #30

Closed 9mido closed 1 year ago

9mido commented 3 years ago

I was not able to figure out how to use counter.dev locally. I assume a domain name with a live website is needed in order to use counter.dev to view the dashboard stats? Just pasting in the javascript into the head tag is easy enough but what do you do afterwards?

ihucos commented 3 years ago

Hey!

So counter is hosted: https://counter.dev/ You do not need to run anything locally. With the project being open source you can run it locally if you want to. There are no docs but it should not be difficult to figure out: essentially you need to run make devserver

What exactly are you trying to achieve?

9mido commented 3 years ago

All I want to do is replace Google Analytics. I tried pasting the javascript for counter.dev but then what is the next step? Do I need a domain name? With Google Analytics, I could test if it is working locally.

driehuis commented 3 years ago

I just tried to do what I think @9mido is doing, which is to test my website in a development environment. In my case, that means that I'm running jekyll serve on my laptop and access the site at http://127.0.0.1:4000/. In the Firefox developer tools under Network, I see the hit to https://counter.dev/track?referrer=&screen=2560x1440&user=myuser&utcoffset=1 with a 200 OK status, but I do not see a web site 127.0.0.1:4000 appear in my list of web sites on the counter.dev dashboard. If I add "127.0.0.1 test.mydomain.org" to my local /etc/hosts file and access Jekyll via http://test.mydomain.org:4000, I do see test.mydomain.org:4000 appear in my list.

Through this experimentation, I think that hits on 127.0.0.1 are ignored by counter.dev, and if you add a dummy domain name to your /etc/hosts, you can locally test the Javascript. @9mido, does that answer your question?

ihucos commented 1 year ago

Thanks