Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new

Learn more

View all

Sign in to view all badges

Hit based segment - data feeds

Level 1
Level 1

Hi community,


I have started working with data feeds and I am not re-creating segments that we use for reporting, whilst I do not have any issues with visit and visitor level segments, I am somewhat struggling with hit based ones.


Below is an example where we exclude some hits based on the following criterias:





Any idea on how to get time spent per visit - granular and content time spent in data feeds?


Many thanks,





1 Reply
Level 5
Level 5

Hypothesizing that 'content time spent' is a custom measure within your organization - but looking at the data feed metrics docs it walks through what is required for time calculations.

Time spent

Hits must first be grouped by visit, then ordered according to the hit number within the visit.
  1. Concatenate post_visid_high , post_visid_low , visit_num , and visit_start_time_gmt .
  2. Sort by this concatenated value, then apply a secondary sort by visit_page_num .
  3. If a hit is not the last one in a visit, subtract the post_cust_hit_time value from the subsequent hit's post_cust_hit_time value.
  4. This number is the amount of time spent (in seconds) for the hit. Filters can be applied to focus on dimension values or eventss


What are you using to query the clickstream data? If you group by the concatenation in step 1 and subtract min(hit_time_gmt) from max(hit_time_gmt) you would likely get the visit duration.