adobe / helix-rum-js

Helix RUM Event Generator for JavaScript
Apache License 2.0
1 stars 8 forks source link

feat(minirum): allow increasing the sampling rate up to 1/10 for specific use cases #159

Closed ramboz closed 2 months ago

ramboz commented 5 months ago

This introduces a new global variable, window.RUM_SAMPLING_RATE, that can be set before loading the library to increase the sampling rate for specific use cases that require more data collected for short-term reporting. For instance:

Usage

For instance:

window.SAMPLE_PAGEVIEWS_AT_RATE = 'high';

Or in an HTML context:

  <head>
    <meta name="experiment" content="Foo"/>
    <meta name="experiment-variants" content="/bar,/baz"/>
    <script>window.SAMPLE_PAGEVIEWS_AT_RATE = document.head.querySelector('meta[name="experiment"]') ? 'high' : null</script>
    <script src="/scripts/aem.js" type="module"></script>
    <script src="/scripts/scripts.js" type="module"></script>
    <link rel="stylesheet" href="/styles/styles.css">
  </head>

Related Issues

Fix #156

trieloff commented 5 months ago

See https://cq-dev.slack.com/archives/C07198KKQ07/p1717543808221569

trieloff commented 4 months ago

Thank you @ramboz. I've added you as a writer to the repository, so you don't need to work off your own fork anymore. On the flip side, please make sure that the change is covered by tests.

trieloff commented 4 months ago

Please merge once the conflicts have been resolved.

ramboz commented 3 months ago

@trieloff Properly rebased this against the latest main… but I'll need you to re-review before I can actually merge

adobe-bot commented 2 months ago

:tada: This PR is included in version 2.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: