This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The Boomerang DimensionStickyPlugin plugin will make a Custom Dimension "sticky" -- | |
* if it is ever set (has a value), it will be always sent on subsequent beacons, | |
* even if the page doesn't set it. | |
* | |
* This plugin will utilize sessionStorage to do this. | |
*/ | |
(function(w) { | |
// | |
// TODO: Configure which mPulse Dimension to make sticky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The Boomerang DisableUnloadBeacon plugin disables sending of the Unload beacon. | |
* | |
* The Unload beacon can be used to understand Session Duration (seconds on the page), but may not be needed in all cases. | |
*/ | |
(function() { | |
window.BOOMR = window.BOOMR || {}; | |
window.BOOMR.plugins = window.BOOMR.plugins || {}; | |
window.BOOMR.plugins.DisableUnloadBeacon = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The Boomerang CWV plugin assists in sending Core Web Vitals metrics First Input Delay (FID) and | |
* Cumulative Layout Shift (CLS) at the end of the page session. It does this by sending | |
* an additional "Page Exit" beacon prior to unload. | |
* | |
* The main changes in behavior over the EventTiming plugin (which sends FID) and Continuity | |
* plugin (which sends CLS) are: | |
* | |
* * If FID was _not_ on the Page Load beacon, this plugin sends FID on the Page Exit beacon. | |
* If FID was on the Page Load beacon, it is _not_ repeated on the Page Exit beacon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The `WaitAfterOnload` Boomerang plugin waits for the specified number of seconds after | |
* onload before a beacon is sent. | |
* | |
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon | |
* for the specified number of seconds. This allows the beacon to contain additional | |
* ResourceTiming data and other metrics/timers that might happen after page load. | |
* | |
* NOTE: Any plugin like this that delays a beacon from being sent after onload | |
* will have an effect on total number of beacons captured (due to the visitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Helper Functions | |
// | |
// Gets a parameter from the URL | |
static function extractGetParameter(name, query) { | |
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(query) || [,""])[1].replace(/\+/g, '%20')) || null; | |
} | |
// Gets a POST or GET parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Repeats all beacons to a second URL. | |
* | |
* To configure, update BEACON_URL. | |
* | |
* This code repeats some code from Boomerang. If you only need to send | |
* XHR beacons, or only image beacons, or not sendBeacon(), it could be trimmed down. | |
* | |
* @class BOOMR.plugins.BeaconRepeater | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Placed in any cross-origin IFRAMEs | |
// | |
if (window !== window.top) { | |
if (typeof window.PerformanceObserver !== "function") { | |
return; | |
} | |
// Listen for all ResourceTimings, repeating them to the parent window | |
var observer = new PerformanceObserver(function(entries) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Naive ResourceTiming crawl of all IFRAMEs. | |
// | |
// Based on https://github.com/SOASTA/boomerang/blob/master/plugins/restiming.js | |
// which you should use to deal with all of the caveats (e.g. startTime adjusting) | |
// | |
function isFrameAccessible(frame) { | |
var dummy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The `DuplicateTimersToBeacon` Boomerang plugin duplicates any mPulse Custom Timers | |
* that are logged in the beacon's `t_other` parameter into distinct beacon parameters. | |
* | |
* e.g: | |
* | |
* t_other=boomerang|17,boomr_fb|2516,boomr_ld|2351,boomr_lat|165,custom5|2112,custom0|27 | |
* | |
* Will add two more beacon parameters: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The `WaitForJsVar` Boomerang plugin waits for the specified JavaScript variable | |
* to exist on the page before a beacon is sent. | |
* | |
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon | |
* until the variable exists. This allows the beacon to contain additional | |
* ResourceTiming data and other metrics/timers that might happen after page load. | |
* | |
* NOTE: Any plugin like this that delays a beacon from being sent after onload | |
* will have an effect on total number of beacons captured (due to the visitor |
NewerOlder