Dashboard visitor counter

Hi,
I want to ask if you know a way how to make a counter for the Dashboard.
So every user who visits the dashboard counts up.
Thanks

Hello there,
There are some ways to do that.
When you say "user" you mean different people or for each visit increment the counter ?

Yes :wink:
Sorry i mean visitors not user.

Is there a good tutorial anywhere, i can not find anything for node-red.
Is it for example possible to analyse the datas with google analytics?

depends how accurate you want it... - the ui_control node does provide an output for every browser connection (and disconnection etc) - so you could use that to trigger a count - but the same browser doing a full refesh will also count as a new connection so may over count.... but hey may be close enough.

You mention Google Analytics - you can embed the necessary GA code via a ui_template node to inject it in the head of the page. No need to build anything in NR itself.

So you think i can copy paste the code from google analytics gtag.js into the ui_template.js and the it should work?

That's what the man said :smile:
Try it and let us know how it turned out

1 Like

I tried it with the template.js & template.html but both of them didnt work.

What exactly do you mean when you say you pasted it in ui_template.js ? Do you mean you literally edited the file?

The suggestion is you drag a ui_template node into your flow and paste the GA code into the contents of the ui_template node so it gets added to your dashboard.

image
This is what @knolleary meant

1 Like

Ah.
I thought i need to edit the file.
How exactly do i need to implement the ui_template into my flow.
Because i made 3 different flows for the same dashboard.

@Balouzard
Thanks now it works.

the ui_template node will refer to the dashboard <head></head>part of the code, doesn't matter how many flows you have created nor how many flows your dashboard refers to

So its really easy to implement Google Analytics to the Node-Red dashboard.
37

21

Thanks for your help.