Share your repls and programming experiences

← Back to all posts
Display view count on a post
h
ironblockhd (345)

First, you need to generate your image codes on https://testcounter.ironblockhd.repl.co.
You can embed the first image where you want to show the count. The second image is invisible, rendering it will increment the total count.

This post has views (reset due to botters lol)

Commentshotnewtop
Lethdev2019 (145)

I just used it on my post ;)

AmazingMech2418 (855)

I totally didn't just bot it. LOL!

while true; do
  curl "https://testcounter.ironblockhd.repl.co/c/2897ec429b2d"
  curl "https://testcounter.ironblockhd.repl.co/v/2897ec429b2d"
done
ironblockhd (345)

Hehe you only have to bot the /c/ one

AmazingMech2418 (855)

@ironblockhd Yeah. I know, but I still botted it...

AmazingMech2418 (855)

@ironblockhd Congratulations on 5092 views by the way! LOL!

DynamicSquid (3294)

What dude this is insane! How'd you make it?

ironblockhd (345)

@DynamicSquid Thanks! i used replits new database and made a simple http server that sends server-generated svg images

DynamicSquid (3294)

@ironblockhd oh I see, that's cool! for an update, could you make it so that only one user can view it one time?

ironblockhd (345)

A lot of people have third party cookies deactivated and google chrome plans to disable it by default, so it wouldn't really be worth it

ironblockhd (345)

haha someone botted the views

HahaYes (1190)

This is really cool ironblock!

Leroy01010 (200)

I wonder how many people read the comments:


ironblockhd (345)

Embed both codes it gives you, for replit posts etc select markdown and for websites select html

Leroy01010 (200)

so i need to copy and paste the code @ironblockhd

ironblockhd (345)

Yep, the code it provies you

ironblockhd (345)

@Leroy01010 np, sorry for understanding the question wrong at first

JosephSanthosh (1140)

So how does this work?

ironblockhd (345)

@JosephSanthosh i used replitDB to storage the counts and have a simple server set up that sends dynamically generated svg images. When you embed the image that it gives you it will display the count

JosephSanthosh (1140)

@ironblockhd Oh Ok. So I just embed the image in the code?

JosephSanthosh (1140)

@ironblockhd Did you write all the code in here? How would I have to add this in my code, do I copy each file seperately?

AncientBison (64)

I wonder can i use markdown...

johndo3 (16)

for some reason it doesnt work on my post, https://repl.it/talk/share/A-blog/49129

ironblockhd (345)

You need to add a image for both links, you also need to add [loading..](https://testcounter.ironblockhd.repl.co/c/65ca4caa5a46)

johndo3 (16)

@ironblockhd I might need you to help me a bit, the counter works, but can you add repl sign-in to my program?

ironblockhd (345)

@Code1Tech thats the link that adds to the count when you render it, here's the link your searching: https://testcounter.ironblockhd.repl.co/v/bdf19bd38de

MagicalCat (0)

This is very cool, this tool can also be multi purpose like you can make it to redirect to your website so that you can count how many people go to your website too!

ironblockhd (345)

Thanks! You can select "html" instead of "markdown" after you generated it and then you get the same images but for your website

adl212 (126)

This is awesome! I can add it to my projects!

hg0428 (167)

Style the counter, needs more work.

ZDev1 (532)


I don't think that 195631 people saw this post
but cool anyway

ironblockhd (345)

Someone spammed views lololol

DynamicSquid (3294)

actually wait no that's a stupid question sorry

DynamicSquid (3294)

Does this work for comments?

Kudos (29)

Does anyone else see this error?
TypeError [ERR_INVALID_URL]: Invalid URL: undefined/views
at onParseError (internal/url.js:257:9)
at new URL (internal/url.js:333:5)
at request (https.js:287:30)
at Object.get (https.js:318:15) at req (/home/runner/databaseTempSync.js:4:10)
at Object.<anonymous> (/home/runner/databaseTempSync.js:14:3) at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14) {
input: 'undefined/views',
code: 'ERR_INVALID_URL'
}

ironblockhd (345)

Noooo not the undefined database bug again :( i already made a post on https://repl.it/bugs/p/database-url-returns-undefined but now i think i know the issue

ironblockhd (345)

Works again now for some reason lol