share groupByTrack function