@financial-times/n-tracking
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -335,3 +335,3 @@ import oTracking from '@financial-times/o-tracking'; | ||
const samplePercentage = 10; | ||
const defaultSampleRate = 10; | ||
@@ -342,3 +342,3 @@ const isContextComplete = (context) => { | ||
const realUserMonitoringForPerformance = () => { | ||
const realUserMonitoringForPerformance = ({ sampleRate } = {}) => { | ||
@@ -351,4 +351,6 @@ // Check browser support. | ||
sampleRate = Number.isFinite(sampleRate) && sampleRate <= 100 && sampleRate >= 0 ? sampleRate : defaultSampleRate; | ||
// Gather metrics for only a cohort of users. | ||
if (!seedIsInSample(spoorId, samplePercentage)) return; | ||
if (!seedIsInSample(spoorId, sampleRate)) return; | ||
@@ -355,0 +357,0 @@ // Proceed only if the page load event is a "navigate". |
@@ -6,3 +6,3 @@ { | ||
"browser": "dist/browser.js", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "repository": "Financial-Times/n-tracking.git", |
@@ -20,3 +20,3 @@ import Perfume from 'perfume.js'; | ||
const samplePercentage = 10; | ||
const defaultSampleRate = 10; | ||
@@ -27,3 +27,3 @@ const isContextComplete = (context) => { | ||
export const realUserMonitoringForPerformance = () => { | ||
export const realUserMonitoringForPerformance = ({ sampleRate } = {}) => { | ||
@@ -36,4 +36,6 @@ // Check browser support. | ||
sampleRate = Number.isFinite(sampleRate) && sampleRate <= 100 && sampleRate >= 0 ? sampleRate : defaultSampleRate; | ||
// Gather metrics for only a cohort of users. | ||
if (!seedIsInSample(spoorId, samplePercentage)) return; | ||
if (!seedIsInSample(spoorId, sampleRate)) return; | ||
@@ -40,0 +42,0 @@ // Proceed only if the page load event is a "navigate". |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1099060
28543