Skip to content

Commit

Permalink
Added guardian for browser support of PerformanceLongTaskTiming 🐿 v2.…
Browse files Browse the repository at this point in the history
…12.5
  • Loading branch information
Adam Braimbridge committed Dec 31, 2019
1 parent 93c15af commit 4c49b5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/client/trackers/real-user-monitoring-for-performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ const requiredMetrics = [
];

const cohortPercent = 5;

export const realUserMonitoringForPerformance = () => {

// Check browser support.
// @see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming
if (!'PerformanceLongTaskTiming' in window) return;

// Gather metrics for only a cohort of users.
if (!userIsInCohort(cohortPercent)) return;

const navigation = performance.getEntriesByType('navigation')[0];
Expand Down

0 comments on commit 4c49b5f

Please sign in to comment.