Phoenix Documentation
Phoenix ProductionPhoenix PreviewContentful
Primary version
Primary version
  • 🔥Phoenix 🔥
  • Installation + Usage
    • Prerequisites
    • Installation
    • Usage
  • Development
    • Architecture
      • Heroku
    • Content Types
      • Action Stats Block
      • Campaign
      • Content Block
      • Cause Page
      • Company Page
      • Current Club Block
      • Current School Block
      • Embed
      • External Link
      • Landing Page
      • Link Action
      • Metadata
      • Page
      • Photo Submission Action
      • Selection Submission Action
      • Share Action
      • Signup Referrals Block
      • Social Drive Action
      • Voter Registration Action
      • Voter Registration Drive Action
      • Voter Registration Marketing Page
      • Voter Registration Referrals Block
    • Features
      • Affiliate Opt In
      • Affiliate Scholarship Block
      • Analytics Waypoint
      • Delayed Element
      • Dismissable Element
      • Stat Card
      • General Buttons
      • Groups
      • Paginated Campaign Gallery
      • Popover Dispatcher
      • Refer A Friend
      • Referrals Gallery
      • Sitewide Banner
      • Sixpack A/B Testing
        • Code Tests
        • Contentful Tests
        • Testing Tips
      • Tooltip
      • Traffic Distribution
      • Volunteer Credits
      • Voter Registration
      • Zendesk Form
    • Contentful
      • Workflow
      • Content Management API Scripts
    • Helpers
  • Phoenix API
    • v2
      • Campaigns Resource
      • Posts Resource
      • Zendesk Endpoint
  • Data + Performance
    • Monitoring
    • Analytics
    • Logging
  • Contributing Instructions
    • Edit This Documentation
    • Glossary
Powered by GitBook
On this page
  1. Development
  2. Features

Traffic Distribution

Sometimes we'll have a feature that we only want to expose to a portion of our traffic. (E.G. a Survey feature, which we'd only like 5 percent of our users to see.)

We have an available wrapper component we use to set this up. It's aptly named the TrafficDistribution component! (Genius).

It's a pretty simple and straightforward component. It'll accept a percentage number as well as the feature name as props, and then make the calculation as to whether to expose or hide the wrapped feature. It will also store the result in localstorage to ensure a level of consistency across visits to the site.

Usage Instructions

Let's use our Survey example.

If we only want to expose this Survey to 5 percent of traffic:

<TrafficDistribution percentage={5} feature="survey_feature">
  <Survey />
</TrafficDistribution>

And viola!

PreviousTooltipNextVolunteer Credits

Last updated 5 years ago