analytics.js-integration-google-analytics icon indicating copy to clipboard operation
analytics.js-integration-google-analytics copied to clipboard

Support for User Timing API

Open pastelsky opened this issue 8 years ago • 6 comments

Is there a way to send custom metrics like user timings through segment ? This is supported by google analytics.

pastelsky avatar Feb 15 '17 03:02 pastelsky

@pastelsky hmm I'm not sure how this would fit given Segment's API spec. It wouldn't really be mapped to .identify() or .track() since we don't have any events spec'd when it comes to tracking user timing. So I'd imagine without a strong case around viable GA User Timing API <> Segment API mapping, we probably won't support this.

hankim813 avatar Feb 15 '17 18:02 hankim813

Just dropping in to say that I'd love to see this supported. I would use it to send client side performance metrics to GA's Site Speed User Timings section.

dazulu avatar Aug 23 '17 13:08 dazulu

@dazulu we still haven't heard much request for this feature and hasn't been something we prioritized. We do accept PRs :)

For now, you can just do this directly

// .ready ensures the ga integration has been initialized, so its safe to reference third party sdk window objects in the callback

analytics.ready(function() {
   // Feature detects Navigation Timing API support.
  if (window.performance) {

   // Gets the number of milliseconds since page load
   // (and rounds the result since the value must be an integer).
   var timeSincePageLoad = Math.round(performance.now());

   // Sends the timing hit to Google Analytics.
   window.ga('send', 'timing', 'JS Dependencies', 'load', timeSincePageLoad);
  }
});

hankim813 avatar Aug 23 '17 16:08 hankim813

I would love to see this prioritized as well

chollier avatar Mar 15 '18 19:03 chollier

👍

ryzy avatar May 24 '18 14:05 ryzy

Hi @pastelsky, as part of the monorepo migration, this issue has been moved to new issue. Our engineers have been notified and will prioritize and work on it ASAP. Thank you!

For more information, see README.md.

SegmentDestinationsBot avatar Aug 13 '19 22:08 SegmentDestinationsBot