Unlike some RUM tools, SpeedCurve allows you to control how many pageviews are sampled. This allows you to monitor your pages while staying within a reasonable budget. Sampling is done based on sessions, so your data includes full user journeys through your site.
There are two ways to set your sample rate: in your Settings and with the RUM API.
In your Settings, click on Edit RUM to change your sample rate. You can enter any integer (no decimals) from 0 to 100 inclusive.
This approach to setting the sample rate is easy for making changes since no code changes are necessary. However, the changes do not take effect immediately. When decreasing the sample rate, it can take as long as 15 minutes for the changes to propagate across the SpeedCurve servers. When increasing the sample rate, the change depends on whether the real user has lux.js in their browser cache. It can take up to a week for all copies of lux.js to be purged from real user's caches, but typically it takes 1-2 days.
The other way to set your sample rate is using
LUX.samplerate = 40;
Make sure this is set before the main lux.js script is loaded.
Setting the sample rate in your code gives you a lot of flexibility because you can vary the sample rate on every page. Here are some scenarios where this is useful:
If you have multiple properties or products (e.g., marketing pages, customer pages, and support docs) you can vary
LUX.sampleratedepending on the type of page. You might want to have a higher sample rate for customer pages where the content varies depending on the specific user, and have a lower sample rate on the marketing and support pages where the content is more static.
If your product is used across multiple countries, you might want to have a higher sample rate for countries that have less traffic so that you have enough data to get statistically sound results.
If you're running an A/B test on a small subset (e.g., 0.1%) of users, you might want to collect 100% of that traffic in order to compare the different test cases.
Important note on sampling with the API
If you have a sample rate of less than 100% in your Settings, this will always take precedence over the
LUX.sampleratevalue. For this reason, if you choose to set your sample rate using
LUX.sampleratethen you need to ensure the sample rate in your Settings is set to 100%.
RUM sampling works at two layers: on the client and during beacon collection. This flow chart explains the points at which a beacon may be rejected.
Setting your sample rate starts with knowing the number of monthly page views for your site. For example, suppose your site gets ~100 million page views per month. If you buy a RUM plan that gives you up to 10 million pageviews per month, you would set the sample rate to 10%. (In fact, you might want to set it to 8% to allow some wiggle room for any spikes you might experience during the month and growth over the year.)
As you use the RUM dashboards, if you find that you're drilling down to where the number of page views is too low (e.g., less than 1000 per data point), then you might want to increase your budget by adding an additional bundle of 10M page views. Then with a budget of 20 million page views, you could set the sample rate to 20% (or 18% to be safe).
There are a couple things you can do to get back under budget:
Reduce your sample rate - Your sample rate is specified under Settings -> RUM. It defaults to 100%, but you can lower your sample rate to a level that stays within your RUM budget.
Increase your budget - You can add more page views to your budget by purchasing additional bundles of page views. See our pricing page for more information.
We're not too worried if you go over your budget a little bit; everyone has spikes now and then. But if you're regularly over budget by more than 10% we'll eventually reach out to see if you'd like to purchase more page views.
Updated about 1 year ago