optimized tracking script