Dashboard visitor counter

#1

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

0 Likes

#2

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

0 Likes

#3

Yes :wink:
Sorry i mean visitors not user.

0 Likes

#4

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?

0 Likes

#5

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.

0 Likes

#6

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.

0 Likes

#7

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

0 Likes

#8

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

1 Like

#9

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

0 Likes

#10

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.

0 Likes

#11


This is what @knolleary meant

1 Like

#12

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.

0 Likes

#13

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

0 Likes

#14

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

Thanks for your help.

0 Likes