Google Analytics Measurement Protocol implementation in JavaScript with offline support