Registering event/goal

I have just installed Matomo and it all seems to be running fine and it’s registering visitors. For my project I have a number of goals I would like to register and I was wondering how to. I have created a goal and added the following code to see if it’s registered, but nothing seems to happen:

_paq.push(['trackEvent', 'register']);

I have also tried which does show under “Direct Entry” but nothing is shown under “Goals”:

_paq.push(['trackGoal', 1]);

Do I understand the concept?

In first instance, you are tracking an event but missing some parameters.

For tracking Goal n# 1 you must have saved that goal-id inside your website tracker profile.

How do I save a goal-id inside my website tracker? When calling the function a flags shows up under “Direct Entry” but I’d expect it to also show up under “Goals”.

Simply add a new goal, then keep its id reference in your javascript

Turns out it works just fine the way I implemented it, but the dashboard doesn’t show it in realtime. A day later and the dashboard shows the goals just fine :+1:

Dashboards are made by Reports, reports are calculated in two ways. By visiting it (gets calculated on the fly by default configuration), or by cron-jobs. The second configuration is better tailored to huge websites, because you can plan to calculate report on each hour (for example)
Documentation and FAQs are explaining it very well.