Skip to content

Traffic Control

Overview

Traffic control lets you decide when Rose appears on your website. It is most often used for gradual rollout: you can start with a small percentage of visitors and increase it as you gain confidence.

Rose can also be restricted by page URL, device type, and host-page data made available in window.dataLayer.

How It Works

When traffic control is enabled, the widget uses a deterministic allocation to decide whether each visitor sees the widget. Each visitor is assigned a stable bucket (0-99) based on their client ID. If their bucket is below the configured traffic percentage, they see the widget.

The allocation is computed fresh on every page load from the server-side configuration, so changes to the traffic percentage take effect immediately.

flowchart TD A[Visitor arrives] --> B{Manual override set?} B -->|Yes| C{Override = true?} C -->|Yes| D[Show widget] C -->|No| E[Widget hidden] B -->|No| F{Traffic control enabled?} F -->|No / 100%| D F -->|Yes| G[Hash client ID to bucket 0-99] G --> H{Bucket < traffic %} H -->|Yes| D H -->|No| E

Configuration

Traffic control is configured by your Rose account manager.

Display Conditions Based on dataLayer

If your website already publishes page context to window.dataLayer, Rose can use those values to decide whether the widget should appear.

This is useful when URL rules are not enough. For example, you might want Rose to appear only for visitors in France, but the relevant pages are dynamic and cannot be listed one by one.

Example host-page data:

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    pageLanguage: 'en',
    countryCode: 'FR',
    pagePostType: 'resources'
  });
</script>

Example Rose display rule:

{
  "key": "countryCode",
  "values": ["FR"]
}

With this rule, Rose appears only when the latest dataLayer value for countryCode is FR.

You can also match nested values with dot notation:

{
  "key": "pagePostTerms.language",
  "values": ["EN"]
}

How Matching Works

  • All configured conditions must match.
  • A condition matches when the dataLayer value equals one of the configured values.
  • If the dataLayer value is an array, any item in the array can match.
  • Later dataLayer.push(...) entries override earlier values for the same key.
  • If a configured key is missing, Rose does not appear.

Your Rose account manager configures these rules for you.

Forcing the Widget Display

If you need to see the widget regardless of traffic allocation percentage (for testing, demos, or troubleshooting), you can override the allocation using your browser's console. URL rules and dataLayer display conditions still apply.

Enable Widget Display

Open your browser's Developer Tools (F12), go to the Console tab, and run:

const data = JSON.parse(localStorage.getItem('rose'));
data.widget.trafficControlOverride = true;
localStorage.setItem('rose', JSON.stringify(data));

Then refresh the page to see the widget.

Disable Widget Display

To simulate being outside the traffic allocation:

const data = JSON.parse(localStorage.getItem('rose'));
data.widget.trafficControlOverride = false;
localStorage.setItem('rose', JSON.stringify(data));

Reset to Natural Allocation

To remove your override and let the system decide naturally:

const data = JSON.parse(localStorage.getItem('rose'));
data.widget.trafficControlOverride = null;
localStorage.setItem('rose', JSON.stringify(data));

Checking Your Current Status

To see your current traffic control status:

const data = JSON.parse(localStorage.getItem('rose'));
console.log('Override:', data?.widget?.trafficControlOverride);
console.log('Last computed decision:', data?.widget?.trafficControl);

This will show:

  • trafficControlOverride: true - You have forced the widget to show
  • trafficControlOverride: false - You have forced the widget to hide
  • trafficControlOverride: null (or missing) - No override; the system decides based on traffic allocation

The trafficControl object shows the last computed decision (for debugging only — it does not influence the widget behavior).

Troubleshooting

If you don't see the widget after forcing the display:

  1. Refresh the page - The override only takes effect after a page reload
  2. Accept cookies - Some websites only load the Rose widget after cookie consent; make sure you've accepted cookies
  3. Check dataLayer values - If Rose is configured to display only when a dataLayer value matches, verify the value exists before Rose loads. This also applies when using the Chrome plugin or a local traffic override.
  4. Disable ad blockers - Ad blockers may interfere with the widget, especially if it's loaded through Google Tag Manager

If the issue persists after trying these steps, contact your Rose account manager.

Notes

  • Traffic control overrides are stored per-browser and per-domain
  • Clearing your browser's localStorage will reset your override and allocation
  • Traffic control settings are managed server-side by Rose; the localStorage override only affects your individual browser
  • dataLayer display conditions apply in addition to URL and traffic allocation settings