Comments (3)
I was happy to help @sukhjinder-kumar
is there something we can do so that Adblocker doesn't block the request?
I don't think so. If user decided to protect his privacy and so Adblock extension prevents to send requests to analytics, there is no way to bypass easily, I guess.
Please check additional info available in GoatCounter's FAQ regarding this problem as there are options described.
from jekyll-theme-chirpy.
@sukhjinder-kumar I have implemented views counter recently using GoatCounter, here what I have done.
- I have copied original
_layouts/post.html
to my project, so I can override it to add views counter where I want it to be
<span>
{% include views.html tooltip=true lang=lang %}
{{ site.data.locales[lang].post.pageview_measure }}
</span>
- Created a new file
_includes/views.html
to have views counter logic
<!-- Views Counter -->
<script>
const r = new XMLHttpRequest();
r.addEventListener('load', function() {
document.querySelector('#views').innerText = JSON.parse(this.responseText).count
});
const uri = location.pathname.replace(/\/$/, "");
r.open('GET', 'https://{{ site.goatcounter.id }}.goatcounter.com/counter/' + encodeURIComponent(uri) + '.json');
r.send();
</script>
<span>
<em id="views">
∞
</em>
</span>
The JS code is taken from GoatCounter site https://www.goatcounter.com/help/visitor-counter#json-851
That's about it. I hope this helps you get what you want while waiting for the changes in the theme.
P.S. Error fetching Json
may be expected when there are no data for page visits in GoatCounter yet.
from jekyll-theme-chirpy.
Thank you for taking your time and helping me out. This solves my issue. Just to be sure, is there something we can do so that Adblocker doesn't block the request? I saw it on your github.io too, ublock is blocking the request (works in incognito).
from jekyll-theme-chirpy.
Related Issues (20)
- Google analytics not working because tag in wrong location HOT 2
- Twitter Cards Missing Images HOT 17
- Error on installing ruby's dependecies stage in GH Actions on 6.4.2 version HOT 2
- I get run failed on everything I do
- Images continue shimmering even after loading HOT 1
- Add print layout for pages and posts HOT 1
- Image Comparison Slider
- Dynamicaly switch logo based on mode-toggle HOT 2
- Add a newsletter form HOT 4
- Error could not find gem `sass-embedded' when executing bundle HOT 9
- Restrict Giscus Origins HOT 5
- Wrong image paths in v6.5.0 HOT 3
- Cannot switch dark/light mode of the website HOT 6
- "Next" and "Previous" buttons HOT 3
- Github Pages deploy error, HTML-Proofer, custom domain? HOT 6
- Github Pages Chirpy Starter Missing Assets
- When using a CDN ( img_cdn ), clickable images doesn't adhere to the CDN settings HOT 3
- Pageviews regression in 6.5.2 gem HOT 2
- default layout should pass lang=lang as parameter to search-loader.html HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jekyll-theme-chirpy.