$lux
This module exposes a global plugin called $lux. It's the central way you communicate with SpeedCurve LUX.
Methods
pageLoading(isLoading)
isLoading- Type:
boolean - Default:
true
- Type:
Starts and stops the LUX page load timers. If logFirstHit is true, this is ignored since LUX will take care of the first hit metrics.
label(name)
name- Type:
string - Required
- Type:
Sets the label of the page in SpeedCurve. By default the page's title is used. This should be called before pageLoading(false)
addData(name, value)
name- Type:
string - Required
- The name of the property you are setting. Examples:
cartTotal,isLoggedIn
- Type:
value- Type:
float,number,string - Required
- The value you want to assign the property.
- Type:
This adds custom data to the current user. This is useful for segmenting performance metrics.
name
used in your SpeedCurve account. Learn more about
customer data
.
mark(markName)
markName- Type:
string - Required
- Type:
This function is identical to performance.mark from the User Timing spec for marking a specific time milestone in the page.
It's a shim for browsers that don't support performance.mark.
- Must be called before
pageLoading(false). - If you need to mark performance before Nuxt is ready, then use the browser's native Performance API directly.
measure(name, startMark, endMark)
label- Type:
string - Required
- Type:
startMark- Type:
string
- Type:
endMark- Type:
string
- Type:
This function is identical to performance.measure from the User Timing spec for measuring the delta between two time milestones in the page.
It's a shim for browsers that don't support performance.measure.
- Must be called before
pageLoading(false). - If you need to mark performance before Nuxt is ready, then use the browser's native Performance API directly.
ignoreLUX
Sometimes it's useful to update a page's url to reflect the current state of the page using this.$router.push. If the url's params change this would trigger LUX to record a new page hit. To avoid this add ignoreLUX:true to the push params.
This will disable LUX until the start of the next nav.
this.$router.push({
name: this.$route.name,
params: {
/* some updated params */
ignoreLUX: true
}
})