R
R
Rufix2020-05-19 15:44:06
JavaScript
Rufix, 2020-05-19 15:44:06

How to track session time in Yandex Metrica?

Never did this. The task was to create a goal that would record the number of people who are on the site for more than one minute. I found an option on Google that will track this through

setTimeout('yaCounterXXXXXX.reachGoal("TARGET_NAME");', ВРЕМЯ_В_МИЛИСЕКУНДАХ);

However, as I understand it, if a person goes to another page of the same site, then this will stop working. How can I make a similar function that will track session duration across the entire site?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-05-19
@Rufix

Is it the goal?
You can use just a segment
5ec4450546ee9273815825.png
. If the goal, then make a script that, when loading any page, checks the value in cookies / sessionstorage.
If there is nothing there, it records the entry time there.
The value is checked by interval. When reached - record the event, clear the timer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question