How to measure specific user sessions?

I’m using the Segment plugin, and I need to fire an event to my analytics when a user is present on a specific page for more than 30 seconds

The page is the main page with URL parameters, when those parameters are not empty they make a specific element group visible

How can I measure those? Is it something with page load, “when a group is visible”, or do I need to use custom JS?

Probably when ‘Page is Loaded’ ‘Make Changes to User’ and set a field of ‘log_in_time = Current Date and Time’. Then add a workflow to ‘Do When A Condition Is True’ and add the conditional for when ‘Current Date & Time - Current User’s log_in_time >= 30 seconds AND Get data from url = whatever’. You could maybe even simplify the ‘Get data from url = whatever’ to a Specific Element is visible.

@williamtisdale correct me if I’m wrong but I believe the current date/time isn’t checked again after the initial page load.

@stavchark thus in order to achieve your desired result you’d need 3 workflows. 1) When page is loaded set 2 custom states. State One with value current date/time + seconds 30. And State Two with current date/time. 2) Use a ‘Do every 5 seconds’ workflow and change State Two’s value to the current date/time. 3) Have a ‘Do when condition is true’ workflow. The condition will be something like 'When State Two’s value > State One’s value AND ‘paramter = X’, then do Y.

1 Like

Yes I just checked lol. You are right. A do Every however many seconds would have to be used instead.

1 Like

Thanks for the answer! Won’t the event fire again and again every 5 seconds?

On the workflow ‘Do when condition is true’ set it to ‘just once’. :slight_smile:

If the user refreshes the page, then yes, after 30 seconds it will happen again. If you don’t want this, you can save something on the user type.

1 Like

I got another approach on FB and I wanted to know which one do you think is most accurate?

" I would do is create a Custom Workflow on the page that fires the event.

Then, add a Page Load workflow that executes “Schedule Custom Event” for Current Datetime + 30 seconds.

This will only trigger if the user is still on the page."