Streaming live at 10am (PST)

Article View counter


#1

Hello!

So I have these tiles (emilsjoberg.se/w) on my website and I’d like there to be a ‘view’ counter for each person clicking on it.

I know a lot of people have put this on a wish list, but I’m hoping you could direct me to somewhere I can find code or something to help me achieve this.

Cheers,
Emil


#2

Hey @Emil.Sjoberg,

This is a good question.

I was able to find the following on Codepen: https://codepen.io/juliogcampos/pen/BzdjwY

Hopefully this is helpful :nerd_face:

  • Micah

#3

Hey @micahryanhtml,

Thank you so much and it might definitely help. Problem is that we need to make webflow remember the click and display it for every user. Imagine it as a youtube views counter.

So I want it to look something like this and count each person visiting.


#4

I need this too, please keep me in the loop if you find out how to do it, thanks so much


#5

Any tips on how to use this code using an html embedded function. Tried it but can get it to work :frowning: thank you…


#6

Of course buddy, I haven’t found anything on the web yet, if I do I will let you know.


#7

Nice one thank you mate


#8

If you are using Google analytics you can use their API.

The Reporting API V4 is what you would need as it allows you to pull from the analytics on your site. The “Realtime API V3” is for real time data like live visitors and such. It’s in limited beta so you have to apply and get whitelisted to use it. However, I’d wager this is probably overkill for what you are trying to accomplish. (Or just more work than it’s probably worth)

The main issue here is that Webflow doesn’t allow us to access the database. So you basically two options

Option 1: Find a way to store the updated page count outside of Webflow

To start any third party solution can fill this role. The first solution I gave earlier, the Google Analytics API, would all be hosted by Google which is why the page count can be retained unlike the Codepen linked above.

Perhaps there’s some business offering this as a paid solution I’m not sure. I haven’t seen anything like that though.

Another way you could do this is by hosting a spreadsheet in Dropbox or Google Drive. For example you can use Google Sheets to act as your “database.” Basically when someone visits your page you would have a Javascript command that updates the Google Sheet, and then another Javascript command that pulls the number of visitors from the spreadsheet.

Here’s some info about the Google Spreadsheets API: https://developers.google.com/sheets/api/

Option 2: Utilize the Webflow API

The webflow API allows us to create new collection items and update them as well. So theroetically it would be possible for you to have a field in your collection titled "Number of Visitors" or something to that effect. Then utilizing the API I suppose you could push an update to that collections "Number of Visitors" field whenever someone visits the page.

I haven’t really played with the Webflow API. So this is just me speculating based on my quick read through of their documentation.


#9

Thanks a lot, perfect!

There is already a view counter in the forum if you look on links. The number is how many people clicked on it. So we know it’s definitely possible, question is how they did it.

This is going to take some time learning, hopefully it will work out.

Cheers


#10

The Webflow forums are a Discord install, which I’m pretty sure comes with that functionality built in…?

But you’re right it’s definitely doable! :smiley:


#12

Hi @Emil.Sjoberg, @RoseWebStudio, and @Modii,

I was able to find the following counter that allows the user to input the URL they would like clicks to be tracked:

website counter

It’s not the prettiest, and it seems quite intensive if we are talking about blog posts, but hopefully it gets our search a tad closer.

The counter can be found at the following URL: http://www.hitwebcounter.com/

Hopefully this helps :nerd_face:


#13

What does (post withdrawn by author) even mean? I haven’t done anything, do I have to do something for the post to stay up?

Yes that helps our search, good work mate!

Thanks


#14

Oh, no worries on the (post withdrawn). I had replied and added some code to this post to see if it would work as expected, then withdraw my reply after testing.

That’s all.

Glad it helps.

There are a couple others that are pretty much exactly like the previously mentioned counter:


#15

Thanks, gosh they are ugly, shows how far we have come with modern web design…close but not good enough for me :frowning: thank you though, keep searching…,